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)

3 comments
Damn, didn't work. Do you know how to use Raycasting? Cause I sure as hell don't. x3
Search up Raycasting the how to make a Raycasting laser gun on wiki.roblox.com
I looked at that page, but I am trying to make area/splash damage, like an AoE attack in World of Warcraft, not just a laser gun.