Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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)
0
da debounce is too long TheluaBanana 946 — 4y
0
Buti changed it and still dosen't work Freddan2006YT 88 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Add a loop

0
What kind of loop while loop for loop?? Freddan2006YT 88 — 4y
Ad

Answer this question