Hi, I'm new to scripting and I need help. I recently made a part which I inserted a script to make it deals damage every 1 second when a player touches it. The script is like this:
local debounce = false script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and debounce == false then debounce = true hit.Parent.Humanoid:TakeDamage(2) wait(1) debounce = false end end)
The problem is that it only deals damage when the player is moving on the part, but when the player stand still and doesn't move, it stops taking any damage. How do I make it so that it still takes damage even if the player doesn't move?
Make a loop that breaks itself when the player stops touching the part. Or just make the script copy some script from RS into Player and let it do the job. If you still have any questions don't fear to ask.