I'm trying to make a part appear, and damage all players (except the client player) within the light's radius (inside the part, which is 16 by 16 by 16 inside a 16 range light). The entire script works, but the damage part is the part I'm trying to figure out. Sometimes it damages them, sometimes it doesn't. Please help. Oh, and, here's the script and the layout is here.
local tool = script.Parent local handle = tool.Handle local light = handle.PointLight local player = game.Players.LocalPlayer local Enabled = true local debounce = false function activated() if Enabled == true then Enabled = false wait() local col = game.Lighting.Storage.collide:Clone() col.Parent = tool col.Position = handle.Position col.Anchored = false wait() light.Brightness = 100 light.Range = 18 wait() col.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= player.Name and debounce == false then debounce = true hit.Parent.Humanoid:TakeDamage(10) debounce = false end end) for i = 1, 10 do wait(.01) col.Position = Vector3.new(0,.01,0) end light.Brightness = 1 light.Range = 16 tool:FindFirstChild("collide"):Destroy() wait(.2) Enabled = true end end script.Parent.Activated:connect(activated)
I cannot be 100% sure this would work but
At line 20, try using
col.LocalSimulationTouched:connect(function(hit)
since this is a localscript.
That is sadly your best hope with a touched bullet in a localscript unless you use Raycast.