(Scroll down for old code)
Oh, by the way, the error occurs when I equip the tool
Just edited it a bit, still says the same thing, but here's the code again. (Layout)
local tool = script.Parent local handle = tool.Handle local light = handle.PointLight local player = game.Players.LocalPlayer local Enabled = true function activated() if Enabled == true then Enabled = false wait() local col = script.collide:Clone() col.Parent = tool col.Position = handle.Position col.Anchored = false wait() light.Brightness = 100 light.Range = 48 wait() col.Touched:connect(function(hit) if hit.Parent.Humanoid and hit.Parent.Name ~= player.Name then hit.Parent.Humanoid:TakeDamage(10) end end) wait(.1) light.Brightness = 1 light.Range = 16 tool:FindFirstChild("collide"):Destroy() wait(.3) Enabled = true end end script.Parent.Activated:connect(activated)
Here is the code, but before you look at it, look at this.
local tool = script.Parent local handle = tool.Handle local light = handle.PointLight local player = game.Players.LocalPlayer function activated() if script.Enabled == true then script.Enabled = false local col = script.collide:Clone() col.Parent = tool col.Position = handle.Position col.Anchored = false light.Brightness = 100 light.Range = 48 col.Touched:connect(function(hit) if hit.Parent.Humanoid and hit.Parent.Name ~= player.Name then hit.Parent.Humanoid:TakeDamage(10) end end) wait(.1) light.Brightness = 1 light.Range = 16 tool:FindFirstChild("collide"):Destroy() wait(.3) script.Enabled = true end end script.Parent.Activated:connect(activated)
Oh, and here's the code for the script I made to attempt to fix it. (The "Script" inside the Light Orb)
while true do --Fix wait(1) if not script.Parent.LocalScript.collide then local c = game.Lighting.Storage.collide:Clone() c.Parent = script end end
Maximum retry depth error usually comes from recursing the same function over and over.
I'll tell you where this infinite loop is.
EDIT:
Worth a shot but
@ line 16, use if hit.Parent:FindFirstachild'Humanoid'
And also try adding debounce
to that event.