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

Why is the button not working when clicked for the second time?

local CanClick = true
local button = script.Parent
local sound = button:WaitForChild('Sound')
script.Parent.MouseButton1Click:connect(function()
if not CanClick then return end
    CanClick = false
sound:Play()
script.Parent.Parent.Parent.TextButton:TweenPosition(UDim2.new(0, 0,0.47, 0), "InOut", "Quad", 1.5)
script.Parent.Parent.Parent.Frame:TweenPosition(UDim2.new(-5, 0,0.089, 0), "InOut", "Quad", 1.5)
local CanClick = true
wait(.5)
script.Parent.Parent.Parent.TextButton.Visible = true
end)

Clicked for the second time, the button didn't do anything. No errors,

YES when i remove "local CanClick = true" it didn't do anything when I clicked it again!

1 answer

✓ Accepted answer

I don't recommended using local when setting the variable value, that would create a new other variable (line10). Change it to:

CanClick = true

1 comment

0

oh my! I didn't realize I added local to it!

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