You will be given a Luau script (that has been decompiled). You…
- User
Assistant: User: System: You will be given a Luau script (that has been decompiled). You will rename the variables and functions to sound better, make the script more coherent, and add comments to areas of the script. Return the fixed script without adding ``` as we handle that. If no script has been given, do not produce any output. Do not respond with anything but the script User: -- Decompiled with Konstant V2.1, a fast Luau decompiler made in Luau by plusgiant5 (https://discord.gg/wyButjTMhM) -- Decompiled on 2024-10-04 18:26:47 -- Luau version 6, Types version 3 -- Time taken: 0.001944 seconds
print("local enabled") local tbl_upvr = {} for _, v in pairs(game.ReplicatedStorage.Effects:GetChildren()) do tbl_upvr[v.Name] = require(v) end game.Lighting.Dead.Enabled = false local LocalPlayer_upvr = game:GetService("Players").LocalPlayer local function _() -- Line 18, Named "ragdoll" --[[ Upvalues[1]: [1]: LocalPlayer_upvr (readonly) ]] local Character_2 = LocalPlayer_upvr.Character if Character_2 then Character_2 = LocalPlayer_upvr.Character:FindFirstChild("Humanoid") end if not Character_2 then else Character_2.BreakJointsOnDeath = false Character_2.RequiresNeck = false Character_2:ChangeState(Enum.HumanoidStateType.Physics) end end local function _() -- Line 29, Named "unragdoll" --[[ Upvalues[1]: [1]: LocalPlayer_upvr (readonly) ]] local Character = LocalPlayer_upvr.Character if Character then Character = LocalPlayer_upvr.Character:FindFirstChild("Humanoid") end if not Character then else Character:ChangeState(Enum.HumanoidStateType.GettingUp) Character.BreakJointsOnDeath = true Character.RequiresNeck = true end end game.ReplicatedStorage:WaitForChild("RagdollClient").OnClientEvent:Connect(function(arg1) -- Line 40 --[[ Upvalues[1]: [1]: LocalPlayer_upvr (readonly) ]] print("got local state "..arg1) local var13 if arg1 == "ragdoll" then var13 = LocalPlayer_upvr.Character if var13 then var13 = LocalPlayer_upvr.Character:FindFirstChild("Humanoid") end if not var13 then else var13.BreakJointsOnDeath = false var13.RequiresNeck = false var13:ChangeState(Enum.HumanoidStateType.Physics) end end if arg1 == "unragdoll" then if LocalPlayer_upvr.Character then end if not LocalPlayer_upvr.Character:FindFirstChild("Humanoid") then return end LocalPlayer_upvr.Character:FindFirstChild("Humanoid"):ChangeState(Enum.HumanoidStateType.GettingUp) -- KONSTANTERROR: Expression was reused, decompilation is incorrect LocalPlayer_upvr.Character:FindFirstChild("Humanoid").BreakJointsOnDeath = true -- KONSTANTERROR: Expression was reused, decompilation is incorrect LocalPlayer_upvr.Character:FindFirstChild("Humanoid").RequiresNeck = true end end) local tbl_upvr_2 = {} function _G.playEffect(arg1) -- Line 47 --[[ Upvalues[2]: [1]: tbl_upvr (readonly) [2]: tbl_upvr_2 (readonly) ]] if tbl_upvr[arg1] and (not tbl_upvr_2[arg1] or 0.1 <= tick() - tbl_upvr_2[arg1]) then tbl_upvr_2[arg1] = tick() tbl_upvr[arg1].play() end end game.ReplicatedStorage:WaitForChild("PlayEffect").OnClientEvent:Connect(function(arg1) -- Line 54 --[[ Upvalues[1]: [1]: tbl_upvr (readonly) ]] if tbl_upvr[arg1] then tbl_upvr[arg1].play() return end end) Assistant: Assistant:
- Assistant
-- Decompiled with Konstant V2.1, a fast Luau decompiler made in Luau by plusgiant5 (https://discord.gg/wyButjTMhM) -- Decompiled on 2024-10-04 18:26:47 -- Luau version 6, Types version 3 -- Time taken: 0.001944 seconds print("local enabled") -- Table to store required effect modules local effectModules = {} for _, effect in pairs(game.ReplicatedStorage.Effects:GetChildren()) do effectModules[effect.Name] = require(effect) end -- Disable dead effect in Lighting game.Lighting.Dead.Enabled = false -- Reference to the local player local localPlayer = game:GetService("Players").LocalPlayer -- Function to apply ragdoll effect to the player's character local function ragdoll() local character = localPlayer.Character if character then local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.BreakJointsOnDeath = false humanoid.RequiresNeck = false humanoid:ChangeState(Enum.HumanoidStateType.Physics) end end end -- Function to remove ragdoll effect from the player's character local function unragdoll() local character = localPlayer.Character if character then local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) humanoid.BreakJointsOnDeath = true humanoid.RequiresNeck = true end end end -- Connect client event to handle ragdoll and unragdoll actions game.ReplicatedStorage:WaitForChild("RagdollClient").OnClientEvent:Connect(function(action) print("got local state "..action) if action == "ragdoll" then ragdoll() elseif action == "unragdoll" then unragdoll() end end) -- Table to store timestamps of effects played local effectTimestamps = {} -- Global function to play an effect with rate limiting function _G.playEffect(effectName) if effectModules[effectName] and (not effectTimestamps[effectName] or 0.1 <= tick() - effectTimestamps[effectName]) then effectTimestamps[effectName] = tick() effectModules[effectName].play() end end -- Connect client event to play effects immediately game.ReplicatedStorage:WaitForChild("PlayEffect").OnClientEvent:Connect(function(effectName) if effectModules[effectName] then effectModules[effectName].play() end end)