Alright so I got this tool right? I'm trying to make it so that when its activated if a player/enemy is in a certain distance it'll make them take damage constantly.
I've tried using things like Ontouch and Touched events but they don't seem to be working properly. They kinda just damage them once and never again unless you reactivate the tool.
Heres my current script, it DOES do the damage just not constantly like I need it to
local DebounceTable = {}
script.Parent.Parent:WaitForChild("HITBOX").Touched:Connect(function(objectThatTouchesTheHitbox)
if objectThatTouchesTheHitbox.Parent then
if objectThatTouchesTheHitbox.Parent:FindFirstChild("Humanoid") then
if DebounceTable[objectThatTouchesTheHitbox.Parent] == true then return end
DebounceTable[objectThatTouchesTheHitbox.Parent] = true
objectThatTouchesTheHitbox.Parent.Humanoid:TakeDamage(10)
wait(0.5)
DebounceTable[objectThatTouchesTheHitbox.Parent] = nil
end
end
end)
Some help on this would be much appreciated thankss

1 comment
Ahh alright thanks this helped a ton