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

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

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

✓ Accepted answer

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)

1 comment

0

Thanks, it works!

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