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

can there get a debounce on my growing script?

Asked by 3 years ago
de = false
function touch(hit)
    if hit.Name == "Key" or hit.Name == "brick"  and de == false then
        script.Parent.Size = script.Parent.Size + Vector3.new(1,1,1)                                
de = true
wait(3)
de = false
    end
    end
script.Parent.Touched:connect(touch)

my debounce doesnt work it just keeps growing without the 3 seconds debounce

0
Im not sure what happenswhen you use or and and inside of a single if then. Maybe because one of them is true, it disregards everything else and runs the code. JustinWe12 723 — 3y
0
You can use a nested if statement, the first one to check the debounce and the second one to check what the hit is. JustinWe12 723 — 3y

Answer this question