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

Control a Player GUI?

Asked by 10 years ago

So, i have a game in which there is a 1-person server. I want to control the PLAYERS GUI not the starter one. I am an intermediate scripter so fell free to speak in heavy scripter talk. Oh yeah and i checked all the wiki articles on GUIs and I couldn't find it.

0
player.PlayerGui SirNoobly 165 — 10y

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

Since everything in StarterGui is cloned into a player's PlayerGui each time they respawn, to edit what the player is currently seeing you must make your changes to the PlayerGui.

game.Players.Player.PlayerGui:ClearAllChildren() --Removes all GUIs a player is currently seeing. 
0
So then you would use the StarterGUI to add a gui? fight4money -2 — 10y
0
In studio, yes. If you create a GUI in StarterGui while the game is running, however, players would not be able to see it until they respawned, Perci1 4988 — 10y
0
Ok so if you're answer is correct you could do: game.Players.Player.PlayerGui.ScreenGUI.TextLabel.Text = "Hello" fight4money -2 — 10y
0
Yes, that would work (assuming someone's name is 'Player'). If you want to edit all the players, use a for loop. For example, 'for i,v in pairs(game.Players:GetPlayers()) do print(v.Name) end' Perci1 4988 — 10y
Ad

Answer this question