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

Help with GUIs?

Asked by 10 years ago

So, this GUI script is in a TextButton in starterGUi. It is supposed to close the opening screen, and open the info screen.

local start = game.StarterGui.ScreenGui.Frame.start
local startscreen = game.StarterGui.ScreenGui.Frame

script.Parent.MouseButton1Click:connect(function()
    startscreen.visible = false
    game.StarterGui.info.visible = true

end)

I am having two problems 1) Nothing happens. 2) the output box says '20:59:24.963 - StarterGui:GetCoreGuiEnabled called from server script. Did you mean to use a local script?' I tried moving to a regular script, the same thing happened. It was originally in a LocalScript. Can you please help? After 30+ minutes of tinkering and YouTube tutorials, I can't figure it out. Thanks! -Anth4598 (Please be respectful in your answers, even if it is a kinda dumb question...)

2 answers

Log in to vote
1
Answered by
Redbullusa 1580 Moderation Voter
10 years ago

There are two errors within the code.

The variables' assignment will only refer to the GUIs that are about to be given to players. Rather than using those two assignments, use this to find the player's GUI instead of the server's:

local start = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.start
local startscreen = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame

Since I'm referring to the client's player (game.Players.LocalPlayer...), then you must use a LocalScript.

Also, on line 06:

    game.Players.LocalPlayer.PlayerGui.ScreenGui.info.Visible = true

--

Another error is within your function. In scripts, property cases are sensitive, and will only access that property if it is spelled correctly. To fix this, capitalize the first letter of "Visible."

Ad
Log in to vote
3
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Well, to start off, you should refer to the PlayerGui instead of the normal StarterGui.

Capitalization is key

LocalScript:

local start = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.start
local startscreen = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame

script.Parent.MouseButton1Click:connect(function()
    startscreen.Visible = false
    game.Players.LocalPlayer.PlayerGui.ScreenGui.info.Visible =  true -- Not sure what you meant on this one. Is 'info' in the Frame? Comment if you have trouble editing this.
end)

0
Actually, info is another frame within StarterGui Antharaziia 75 — 10y

Answer this question