I’m currently working on my game, and I ran into a problem. The scripts runs in ServerScriptService, and whenever I use StarterGUI, it doesn’t work. Someone told me to use PlayerGUI, but I’m not sure how. If someone could explain how PlayerGUI works, that would be great!
The PlayerGui can only be controlled through local scripts, which means on the client side. If your really need a server script, I recommend using remote events. If not, use a local script placed in StarterPlayerScripts!
Hope that helped,
Theyoloman1920
Edit: Here is a tutorial on remote events, in case you don’t know about them.
PlayerGUI is the players/clients GUI StarterGUI is the servers GUI
Which should I use? When I use StarterGUI it just glitches out
PlayerGui is where all the GUIs in starterGui get cloned to when the player first joins. PlayerGui is the one that actually shows the changes that you make to GUIs, and that’s why you need to change them in the individual’s playerGui.
you can also do
game.Players.PlayerAdded:Connect(function(player)
player.PlayerGui.ScreenGui.Example.Visible = true
end)
Here is the post BTW:
So basically, when a game initializes “StarterGui” is replicated to each individual player. From there, all handling is done through “PlayerGUI”. For example, if you wanted to make all of the player’s gui’s invisible through a server script, you’d need to do something such as a “for” loop and cycle through each player. There is many other ways to do this, like doing what @AccessQ said. Any method of retrieving a player is a possibility to affect playergui.
Edit: Feel free to DM me on Discord if you need any help (Bay#6969)