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

Only have of my gui script is working half the way its suppose to, can someone help me fix it?

Asked by 5 years ago
Edited 5 years ago

My script opens the gui, but it doesnt close it, can someone fix it?

wait(1)
local Active = game.Players.LocalPlayer.PlayerGui.ScrollingGui.Enabled

script.Parent.MouseButton1Click:connect(function()
if Active == false then
game.Players.LocalPlayer.PlayerGui.ScrollingGui.Enabled = true
end
if Active == true then
game.Players.LocalPlayer.PlayerGui.ScrollingGui.Enabled = false
end
end)

1 answer

Log in to vote
0
Answered by
yHasteeD 1819 Moderation Voter
5 years ago
Edited 5 years ago

you can not try to get a value in a variable, I recommend putting the Enabled after Active, you can use this script:

wait(1)
local Active = game.Players.LocalPlayer.PlayerGui.ScrollingGui

script.Parent.MouseButton1Click:Connect(function()
    if Active.Enabled == false then
        game.Players.LocalPlayer.PlayerGui.ScrollingGui.Enabled = true
    else
        game.Players.LocalPlayer.PlayerGui.ScrollingGui.Enabled = false
    end
end)
0
Thanks, it works! protectiverobos -50 — 5y
Ad

Answer this question