make me a roblox luau script that does this When some hits me, i will get a juju…
- User
make me a roblox luau script that does this When some hits me, i will get a juju notification saying something like " () Has hit you for damage" and then " () Has killed you"
DONT ADD THE TAB
Elements Here is an explanation of menu elements and their respected properties.
Creating a Tab To start adding your own elements, you must create a tab using juju.create_tab; shown below.
Copy juju.create_tab(name: String) Argument Type Description name
String
The tab's name, providing no name will default it to the addon's file name
Creating Sections To create a section, you must create a section using juju.create_section; this will error if a tab is not created beforehand.
Copy juju.create_section(name: String, size: Number, side: Number, offset: Number) Argument Type Description name
String
The section's name
side
Number
The side the section will be placed on in the tab, 1 = left, 2 = light
size
Number
The vertical size of the section (0.1-1)
offset
Number
The vertical offset of the section (0-0.9)
Creating Elements To create a section, you must create a section using juju.create_element.
When using juju.create_element there is an argument labeled types. Below is a fully working addon example of how to properly set up this argument.
Copy juju.create_tab() juju.create_section("example_section", 1, 1, 0)
juju["create_element"]("example_section", { ["name"] = "example colorpicker" }, { ["colorpicker"] = { ["color_flag"] = "example_color", ["default_color"] = Color3.fromRGB(0,255,0), ["transparency_flag"] = "example_transparency", ["default_transparency"] = 0 } })
Element Properties Each type of element has unique properties that you can assign them when creating; and this page lists them all.
Toggle Argument Type Description default
Boolean
The default state of the toggle
flag
String
The flag assigned to the toggle value
Slider Argument Type Description min_text
String
The text the slider displays when the slider's value is the lowest possible
max_text
String
The text the slider displays when the slider's value is maxxed out
decimals
Number
The decimal amount used in slider value (1 = first decimal place, and so on)
default
Number
The default value of the slider
prefix
String
The text that shows before the value in the menu
suffix
String
The text that shows after the value in the menu
flag
String
The flag assigned to the slider value
min
Number
The minimum value allowed to set the slider to
max
Number
The maximum value allowed to set the slider to
Dropdown Argument Type Description default
Table
The default options to be selected
options
Table
The options available in the dropdown
requires_one
Boolean
Whether or not the dropdown selection can be none
multi
Boolean
Whether or not multiple options can be selected
flag
String
The flag assigned to the dropdown selected options
Colorpicker Argument Type Description default_transparency
Number
The default transparency of the colorpicker
transparency_flag
String
The flag assigned to the transparency value
default_color
Color3
The default color of the colorpicker
color_flag
String
The flag assigned to the color value
Textbox Argument Type Description default
String
The default value of the textbox
flag
String
The flag assigned to the textbox value
Button Argument Type Description confirmation
Boolean
Whether or not the button must be clicked twice (confirmed) to activate, like seen with the load and save config buttons
Element API Each signal is fired when a new value is set to an element, some may not if the second argument to the setting function is true.
Copy element:create_settings() Returns Type Description section (copy)
Table
This creates a fake section openable by the cog icon next to your element label. This fake section's create_element function has identical functionality to juju.create_element, just without the section name arg.
Copy element:set_visible(visible: Boolean) Returns Description None
N/A
Toggle Signal Description on_toggle_change
This signal is fired the first argument being the new value of the toggle
Function Return Type Description set_toggle
None
Sets the toggle state to the first argument
Copy local void_hide = juju"find_element"
local connection = juju["create_connection"](void_hide["on_toggle_change"], function(bool) print(bool) -- will print true after it is set below, unless void hide- -- is already on in which case this signal will not fire end)
void_hide:set_toggle(true) Slider Signal Description on_slider_change
This signal is fired the first argument being the new value of the slider
Function Return Type Description set_slider
Number
Sets the slider value to the first argument
Dropdown Signal Description on_dropdown_change
This signal is fired the first argument being the new value of the dropdown
Function Return Type Description set_dropdown
None
Sets the selected dropdown options to the first argument
set_options
None
Sets the dropdown's available options to the first argument
Colorpicker Signal Description on_transparency_change
This signal is fired with the first argument being the new transparency of the colorpicker
on_color_change
This signal is fired with the first argument being the new color of the colorpicker
Function Return Type Description set_colorpicker_transparency
None
Sets the colorpicker transparency to the first argument
set_colorpicker
None
Sets the colorpicker color to the first argument
Textbox Signal Description on_textbox_change
This signal is fired with the first argument being the new value of the textbox
Function Return Type Description set_textbox
None
Sets the textbox value to the first argument
Button Signal Description on_clicked
This signal is fired when the button is clicked in the menu
Utility Functions Here is a list of the available functions used to assist script developers
Copy juju.on_unload(callback: Function) Argument Type Description callback
Function
This function is called when the addon is unloaded
Copy juju.create_connection(signal: RBXScriptConnection or Table, callback: Function) Argument Type Description signal
RBXScriptSignal or table (custom signals)
The signal to connect the callback to
callback
Function
The function to connect to the signal
Return Type Description RBXScriptSignal or table (custom signals)
Signal object, can use :Disconnect etc
Copy juju.find_element(section: String, feature: String) Return Type Description Table
An element, like given from create_element
If you are attempting to access a feature within an element's settings, use the element/feature as the parent name instead of the section. Also, this is an expensive function; it is recommended to only use this during initialization.
Example: juju.find_element("ragebot", "void hide")
Copy juju.get_flags() Return Type Description Table
A table holding the names of all juju flags
Copy juju.get_flag(flag: String) Return Type Description Any
The value of the flag given
Copy juju.set_flag(flag: String, value: Any) Return Type Description None
N/A
Copy juju.get_signals() Return Type Description Table
A table holding the names of all juju signals
Copy juju.get_signal(name: String) Return Type Description Table / RBXScriptSignal
The found signal
This, along with some other functions may not error if the function failed to complete. If the signal does not exist, this function will not error. It is recommended you complete these sort of checks your self.
Copy juju.create_notification(text: String, type: Number, time: Number) Argument Type Description text
String
The text that will be displayed over the notification
type
Number
The type of notification being sent, 1 = Success, 2 = Alert, 3 = Fail
time
Number
The amount of time the notification is on screen (0.5 - 7 seconds only)
Copy juju.set_player_status(player: Instance (Player), status: Number) Argument Type Description player
Instance (Player)
The player that will have their status set
status
Number
The status the player is being set as, 1 = Neutral, 2 = Friendly, 3 = Enemy
Copy juju.get_player_status(player: Instance(Player)) Return Type Description Number
The player's current status, 1 = Neutral, 2 = Friendly, 3 = Enemy
Copy juju.get_active_keybinds() Return Type Description Table
Example return result: {["silent aim"] = true, ["prediction"] = 1948.6923814}
Copy juju.load_config(name: String) Argument Description name
The name of the config, without the extension. default.cfg -> juju.load_config("default")
example script 1:
local juju = juju -- This is not neccessary. local create_connection = juju["create_connection"] local create_notification = juju["create_notification"] local players_service = cloneref(game:GetService("Players")) local player_image_data = base64_decode("") local do_join_notification = function(player) create_notification(player["Name"].." has joined the server!", 2) end local do_leave_notification = function(player) create_notification(player["Name"].." has left the server!", 2) end -- >> ui toggle local example_toggle = juju["create_element"]({ ["name"] = "player join logs" }, { ["toggle"] = { flag = "example", default = false } }) -- >> core local example_connection2 = nil local example_connection = nil create_connection(example_toggle["on_toggle_change"], function(bool) if example_connection then example_connection:Disconnect() example_connection = nil end if example_connection2 then example_connection2:Disconnect() example_connection2 = nil end if bool then example_connection = create_connection(players_service["PlayerAdded"], do_join_notification) example_connection2 = create_connection(players_service["PlayerRemoving"], do_leave_notification) end end) -- >> clean up juju["on_unload"](function() print("bye bye :(") -- Notice we don't need to disconnect our connections above since we -- used juju's built in create_connection function! end)example script 2:
-- >> variables local juju = juju local get_flag = juju["get_flag"] local delay = task["delay"] -- >> core local twod_hit_marker = juju["find_element"]("2d hit marker", "color") local threed_hit_marker = juju["find_element"]("3d hit marker", "color") local set_old = function(d2, d3) twod_hit_marker:set_colorpicker(d2) threed_hit_marker:set_colorpicker(d3) end local hit_callback = function(player, part) if part["Name"] == "Head" then local color = get_flag("hit_marker_headshot_color") local old_d2_color = get_flag("d2_hit_marker_color") local old_d3_color = get_flag("d3_hit_marker_color") twod_hit_marker:set_colorpicker(color) threed_hit_marker:set_colorpicker(color) delay(0, set_old, old_d2_color, old_d3_color) -- >> restore flags asap end end juju["create_element"]({ ["name"] = "hit marker headshot color" }, { ["colorpicker"] = { ["color_flag"] = "hit_marker_headshot_color", ["default_color"] = Color3.fromRGB(0,255,0), ["transparency_flag"] = "hit_marker_headshot_transparency", ["default_transparency"] = 0 } }) local signal = juju["get_signal"]("on_local_bullet_confirmed") local callbacks = signal["callbacks"] -- >> insert it as the first one so we can set the fflag before the hitmarker runs for i = #callbacks, 1, -1 do callbacks[i + 1] = callbacks[i] end callbacks[1] = hit_callback -- >> clean up juju["on_unload"](function() -- >> remove callback and restore old table positions for i = 1, #callbacks - 1 do callbacks[i] = callbacks[i + 1] end callbacks[#callbacks] = nil end) -- >> loaded juju["create_notification"]("loaded hitmarker head color lua by xander", 1)example script 3:
-- >> variables local juju = juju local create_connection = juju["create_connection"] local is_purchasing = juju["is_purchasing"] local purchase_item = juju["purchase_item"] local players_service = cloneref(game:GetService("Players")) local local_player = players_service["LocalPlayer"] local local_character = local_player["Character"] local local_hrp = local_character and local_character:FindFirstChild("HumanoidRootPart") or nil local on_local_character_loaded = juju["get_signal"]("on_local_character_loaded") local find_first_child = workspace["FindFirstChild"] local wait_for_child = workspace["WaitForChild"] local heartbeat = cloneref(game:GetService("RunService"))["Heartbeat"] -- >> get data local data_folder = wait_for_child(local_player, "DataFolder", 9e9) local information_folder = wait_for_child(data_folder, "Information", 9e9) local muscle_information = wait_for_child(information_folder, "MuscleInformation", 1) or {["Value"] = -150} if not muscle_information then local connection = nil; connection = create_connection(information_folder["ChildAdded"], function(child) if child["Name"] == "MuscleInformation" then muscle_information = child connection:Disconnect() end end) end -- >> ui toggle local toggle = juju["create_element"]({ ["name"] = "auto skinny" }, { ["toggle"] = { flag = "auto_skinny", default = false } }) -- >> core local character_added_connection = nil local auto_skinny_connection = nil local update_character_information = function() local_character = local_player["Character"] local_hrp = wait_for_child(local_character, "HumanoidRootPart", 9e9) end local do_auto_skinny = function() if not local_character or not local_hrp then return end local lettuce = find_first_child(local_player["Backpack"], "[Lettuce]") -- > not setting up caching for an example script f off if lettuce then lettuce["Parent"] = local_character lettuce:Activate() return end if tonumber(muscle_information["Value"]) > -15000 and not is_purchasing() then purchase_item("lettuce") end end create_connection(toggle["on_toggle_change"], function(value) if character_added_connection then character_added_connection:Disconnect() character_added_connection = nil end if auto_skinny_connection then auto_skinny_connection:Disconnect() auto_skinny_connection = nil end if value then character_added_connection = create_connection(on_local_character_loaded, update_character_information) auto_skinny_connection = create_connection(heartbeat, do_auto_skinny) end end) -- >> clean up juju["on_unload"](function() end) Assistant
Here's a Roblox Luau script that implements the hit and kill notifications using Juju:
local juju = juju local players_service = game:GetService("Players") local local_player = players_service.LocalPlayer -- Create a tab for the script juju.create_tab("Hit Notifications") -- Create a section in the tab juju.create_section("Notification Settings", 1, 1, 0) -- Create a toggle to enable/disable hit notifications juju.create_element("Notification Settings", { ["name"] = "Enable Hit Notifications" }, { ["toggle"] = { ["flag"] = "hit_notifications_enabled", ["default"] = true } }) -- Function to create hit notification local function create_hit_notification(attacker, damage) if not juju.get_flag("hit_notifications_enabled") then return end juju.create_notification(string.format("%s (%s) Has hit you for %d damage", attacker.Name, attacker.DisplayName, damage ), 2, 2) end -- Function to create kill notification local function create_kill_notification(attacker) if not juju.get_flag("hit_notifications_enabled") then return end juju.create_notification(string.format("%s (%s) Has killed you", attacker.Name, attacker.DisplayName ), 3, 3) end -- Connect to the damage event (you'll need to replace this with the actual game's damage event) local damage_signal = juju.get_signal("on_player_damaged") juju.create_connection(damage_signal, function(victim, attacker, damage) if victim == local_player then create_hit_notification(attacker, damage) end end) -- Connect to the kill event (you'll need to replace this with the actual game's kill event) local kill_signal = juju.get_signal("on_player_killed") juju.create_connection(kill_signal, function(victim, attacker) if victim == local_player then create_kill_notification(attacker) end end) -- Cleanup on unload juju.on_unload(function() -- Disconnect any connections if needed end)Important Notes:
- This script assumes the existence of specific signals like
on_player_damagedandon_player_killed, which you'll need to replace with the actual signals from the game you're playing. - The script creates a toggle in the Juju menu to enable/disable hit notifications.
- It uses different notification types:
- Type 2 (Alert) for hit notifications
- Type 3 (Fail) for kill notifications
- The notifications will show the attacker's username, display name, and damage (for hits) or just username and display name (for kills).
You'll need to modify the signal connections to match the specific damage and kill events in your Roblox game. The current script is a template that you'll need to adapt to the specific game's event system.
- This script assumes the existence of specific signals like
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.