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)
I'm not entirely sure, but it could have an issue with the hit.Parent:FindFirstChild("HumanoidRootPart") condition. Sometimes a handle from a hat or something can mess this up. To make sure HumanoidRootPart is really there, try this:
hit:FindFirstAncestorOfClass("Model"):FindFirstChild("HumanoidRootPart")