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
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)