Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

changing a variable from true back to false?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by
d3nton 19
3 years ago
Edited 3 years ago

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)
0
it shows a error person13042 9 — 3y
0
what is the error it is giving you d3nton 19 — 3y
0
Players.person13042.PlayerGui.ScreenGui.LocalScript:10: Expected identifier when parsing expression, got ')' person13042 9 — 3y
0
Oops my mistake try it now d3nton 19 — 3y
0
tysm person13042 9 — 3y
Ad

Answer this question