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

StarterGui Not Opening in RobloxGame But in Robloxstudio works Joined Help!?

Asked by 6 years ago

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)

?????????????????????????????????????????????????????????????????

0
Is this a normal/server script ? LeadRDRK 437 — 6y
0
no User#21499 0 — 6y
0
give me a screenshot of the objects in startergui and ill solve it Zafirua 1348 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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)
Ad
Log in to vote
0
Answered by 6 years ago

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)

Answer this question