So even with a debounce on my explosion part script, i added a print statement to see how many times it explodes. When i run it and touch the part, it prints multiple times, even with the debounce. Any reasons?
local debounce = false
script.Parent.Anchored = true
script.Parent.Position = Vector3.new(3,0.5,3)
script.Parent.Touched:Connect(function(hit)
if debounce == false and hit.Parent:FindFirstChild("HumanoidRootPart")
then
debounce = true
local explosion = Instance.new("Explosion")
script.Parent.BrickColor = BrickColor.new("Really red")
explosion.Position = hit.Parent:FindFirstChild("HumanoidRootPart").Position
explosion.Parent = hit.Parent:FindFirstChild("HumanoidRootPart")
game.Workspace.Part.pow:Play()
print("Explosion")
end
wait(10)
debounce = false
script.Parent.BrickColor = BrickColor.new("Medium stone grey")
end)

1 comment
Its an explosion part btw. When i touch a part my character explodes.