Why isnt this working?

image
(this is what i have i used the roundify plugin)

game.Lighting.Brightness = 0
wait(10)
game.StarterGui.ScreenGui.Enabled = true
game.Lighting.Brightness = 0.1
workspace.Light1.Transparency = 0
workspace.Light1.PointLight.Brightness = 0.09
wait(2)
game.StarterGui.ScreenGui.TextBox.Text = "Test \n This is a test."

you woud expect this to after 10 seconds make the Gui enabled, right? well this is not the case. What this does is in the properties menu it says the text has changed but it hasnt.
image
This also happens with the enabled script.

Does anyone know why this is happening?
Some Other info:
The Gui is in starter Gui
The Gui wont appear (since the enable script is working but it isnt with visibility)
Even if i enable the Gui from the start, the second script (The “This is a test” one doesnt work)

3 Likes

This is because you change the starterGui’s text, not the Player’s PlayerGui.

4 Likes

Hello ChickHenEn!

I believe the problem in your code is that you are trying to change the GUI the player should start out with after they already loaded in. When you start the game and join in the script delays the script much longer than how fast you load in. This makes the other lines of code affecting the player’s starter GUI useless because you already are in the game with the starter GUI given to you at the start in the form of “PlayerGui”. To fix this, you want to instead change the player’s PlayerGui by putting this code in a local script within the “ScreenGui”:

local Screen = script.Parent

wait(10)
Screen.Enabled = true
wait(2)
Screen.TextBox.Text = "Test \n This is a test."

The difference here is that the script changes the “ScreenGui” directly in the player’s GUI instead of changing the “starterGUI”. Essentially, if you’re going to change a player’s GUI after they already joined the game, you have to directly access their “PlayerGui” instead of the “StarterGui” by using local scripts within “StarterGui”. As for the code regarding the game’s lighting, put it in another script outside of the player GUI scripts since it isn’t relevant to it. This also makes it where the player’s GUI will change after 10 seconds regardless of what time they joined the game for consistency. Hope this helped!

1 Like

You should be using Player.PlayerGui, StarterGui isn’t visible in game, and everything inside it is copied over to the player’s PlayerGui when they join the game.

2 Likes

Replace any instances of game.StarterGui to game.Players.LocalPlayer.PlayerGui.

(Also are you using the old Roundify? The creator made something called UiTools which is a bit better than Roundify for adding rounded corners (you can just use a UICorner though)

Hey bro, the problem is what you trying to get your gui from server, not from client. You need to do like that.

local PlayerGui = game.Players.LocalPlayer.PlayerGui
game.Lighting.Brightness = 0
wait(10)
PlayerGui.ScreenGui.Enabled = true
game.Lighting.Brightness = 0.1
workspace.Light1.Transparency = 0
workspace.Light1.PointLight.Brightness = 0.09
wait(2)
PlayerGui.ScreenGui.TextBox.Text = "Test \n This is a test."
1 Like

Oh crap, i wrote
game.Player it must be game.Players

Some information i forgot to put:
the script is not a local script (when i try to put it in a local script the script just doesnt work)
the script is in server script storage

i also get this error
image

Nevermind i found the solution:
a local script cant be in server script storage. Thanks for your help!

1 Like