I have a script in this thing you're supposed to grab like a coin, where it disappears slowly when you touch it and also makes an achievement sound. The problem is that if you touch it more than once, somehow the debounce doesn't stop the function from overlapping, so it disappears almost instantly instead of taking two whole seconds. Is there something wrong with the placement of debounce?
debounce=false function Spud(g) if g.Parent:findFirstChild("Humanoid") and debounce==false then debounce=true script.Parent.Sound:play() for i=1,20 do local p=script.Parent p.Position=Vector3.new(p.Position.x,p.Position.y+0.15,p.Position.z) p.Transparency=p.Transparency+0.05 p.Mesh.Scale=Vector3.new(p.Mesh.Scale.x+0.1,p.Mesh.Scale.y+0.1,p.Mesh.Scale.z+0.1) wait(0.1) end end debounce=false script.Parent:Destroy() end script.Parent.Touched:connect(Spud)
If you use a bool value for "debounce," it will work. Tested and it works.