You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to create a function that when the player touches the fire sphere he takes 5 ticks of damage and then waits 5 seconds for the function to work again
-
What is the issue? The problem is that when I do this it ends up spamming the function several times
-
What solutions have you tried so far? I tried on the dev forum but it doesn’t seem to have the same problem that I
Here is my code
powerRange.Touched:Connect(function(hit)
print("A")
if damaged == false then
damaged = true
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
hum.Health = -10
task.wait(1)
hum.Health = -10
task.wait(1)
hum.Health = -10
task.wait(1)
hum.Health = -10
task.wait(1)
hum.Health = -10
end
hit.Color = Color3.new(1, 0.917647, 0.027451)
hit.Material = Enum.Material.Neon
end
task.wait(5)
damaged = false
end)```
Please do not ask people to write entire scripts or design entire systems for you. If you can't answer the three questions above, you should probably pick a different category.