Gui Is not open in Roblox Game Joined But when you click in robloxstudio its works script whats wrong?
script.Parent.MouseButton1Click:connect(function() if script.Parent.Parent.Box.Visible == false then script.Parent.Text = "Close" script.Parent.Parent.Box.Visible = true script.Parent.Text = "Settings" script.Parent.Parent.Box.Visible = false end end)
?????????????????????????????????????????????????????????????????
Dude you got to let your script breath a little. Your computer can run the script in a second, but the roblox servers can't run it as fast as your computer can. So I highly recommend that you add some waits.
script.Parent.MouseButton1Click:connect(function() if script.Parent.Parent.Box.Visible == false then script.Parent.Text = "Close" wait(0.1) script.Parent.Parent.Box.Visible = true wait(0.1) script.Parent.Text = "Settings" wait(0.1) script.Parent.Parent.Box.Visible = false end end)
Also your script literally makes no scence. You want your script to making a text say close. Then you want a box to be visible. Then you want the same text to say settings then you want the same box to be invisible? If that is how you want it to work, then I guess use that, but this script would make more scence.
script.Parent.MouseButton1Click:connect(function() if script.Parent.Parent.Box.Visible == false then script.Parent.Text = "Close" wait(0.1) script.Parent.Parent.Box.Visible = true elseif script.Parent.Parent.Box.Visible == true then script.Parent.Text = "Settings" wait(0.1) script.Parent.Parent.Box.Visible = false end end)
You don't need to use an if statement checking if it's visible to make it invisible.
local box = script.Parent.Parent.Box script.Parent.MouseButton1Click:Connect(function() box.Visible = not box.Visible -- changes its current Visible state to its opposite. if box.Visible == true then script.Parent.Text = "Close" else -- don't need to say elseif box.Visible == false as else alone says this. script.Parent.Text = "Settings" end end)