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

changing a variable from true back to false?

im trying to set the variable (myboolvar) from true back to false after i press a onscreen button to prevent the button from being pressed again but that is not the case as i can still press the button as many times as a want so could someone help me to fix this? (line 15)

local myboolvar = nil
myboolvar = true
if myboolvar == false then

end
if myboolvar == true then
	local button = script.Parent.Frame.Thebutton

	button.MouseButton1Click:Connect(function()
		TypeSound:Play()
		typewrite(textLabel, "Click the button to continue.",0.1)
		TypeSound:Stop()
	end)
end
myboolvar = false

1 answer

✓ Accepted answer

Try this

local myboolvar = true
local button = script.Parent.Frame.Thebutton

button.MouseButton1Click:Connect(function()
	if myboolvar == true then
		TypeSound:Play()
		typewrite(textLabel, "Click the button to continue.",0.1)
		TypeSound:Stop()
		myboolvar = false
	end
end)

5 comments

0

it shows a error

0

what is the error it is giving you

0

Players.person13042.PlayerGui.ScreenGui.LocalScript:10: Expected identifier when parsing expression, got ')'

0

Oops my mistake try it now

0

tysm

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