Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my script stop working when i add a debounce? (Fixed by me)

My script stops working when I add a debounce too it why?

Thanks in advance.

local Part = workspace:WaitForChild("Breakable_Glass")
local Delay = workspace.Breakable_Glass:WaitForChild("DelayOfSpawnAndDeb")
local Particle = workspace:WaitForChild("Breakable_Glass").GlassShatter
local shatter = game.ReplicatedStorage.starter:WaitForChild("Shatter")
local sound = Part.Sound
local running = false



Part.Touched:Connect(function(hit)
	if not running then running = true
		if hit.Parent:FindFirstChild("LeftFoot") or
			hit.Parent:FindFirstChild("RightFoot") then
			hit.Parent:FindFirstChild("AnimateCoins").Disabled = false
		Particle.Enabled = true
		wait(0.2)
		Particle.Enabled = false
		Part.Parent = game.ReplicatedStorage
		shatter.Parent = workspace.Glass_Shatters
		shatter.Anchored = true
		sound:Play()
		shatter.Parent = game.ReplicatedStorage:WaitForChild("Glass")
		wait(5)
		running = false
		else
end
	end
	 end)

2 comments

0

da debounce is too long

0

Buti changed it and still dosen't work

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.