I don't know why, but the debounce on this script wont work. I'm not very good with debounce, so i don't know what's failing. Even though I have the debounce script, this script will play a million times when touched
--Variables
function fade()
script.Parent.Parent.Enabled = true
for i = 0, 1, 0.05 do
script.Parent.TextTransparency = i
wait(0.05)
end
for i = 1, 0, -0.05 do
script.Parent.TextTransparency = i
print(i)
wait(0.05)
end
script.Parent.Parent.Enabled = false
return
end
local debounce = false
--Variables
workspace.Earth.Earth.Touched:connect(function()
if debounce == false then
debounce = true
-- script.Parent.Text = "Earth"
fade()
end
end)
workspace.Earth.Earth.TouchEnded:connect(function()
if debounce == true then
debounce = false
script.Parent.Parent.Enabled = false
wait(1)
debounce = false
end
end)
I don't know what's wrong.

1 comment
I don't see the point of the debounce though :/