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

How to update a player's starter gui?

Asked by 7 years ago

So i've made a player list and the code is as simple as this:

1game.Players.PlayerAdded:connect(function(p)
2    if game.StarterGui.plrlist.Frame.plr.Text == " " then
3        game.StarterGui.plrlist.Frame.plr.Text = p.Name
4        game.StarterGui.plrlist.Frame.plr.Name = p.Name
5    end
6end)

But what I want to know is how I can update the Gui for everyone each time someone joins the server because all it's doing right now is, let's say I join in first, it'l show my name and then someone else joins, it won't show their name on my Gui but it will on their's because when they entered the server the main gui already had my name in it.. So basically I just need to know how to refresh/update the Gui in everyone's game.Players.<plrname>.StarterGui.

1 answer

Log in to vote
0
Answered by 7 years ago

The problem is that StarterGui is simply a place to put things that will be cloned into a player's PlayerGui (what you are incorrectly referring to as "a player's StarterGui"). There are also a few other complications if you used PlayerGui, so instead you should instead use a script in the GUI which would be much simpler overall.

You can do it inside a LocalScript, and use LocalPlayer to get the player's name. (Make sure to put your LocalScript inside plrlist.)

1local Player = game.Players.LocalPlayer -- get the player that the local script is running on
2local Label = script.Parent.Frame.plr -- make it a variable so you don't have to get it twice
3 
4Label.Text = Player.Name
5Label.Name = Player.Name

Hope I helped!

~TDP

0
Um... I tried it and it didn't work joshmatt2244 28 — 7y
0
What was the error in the output? TheDeadlyPanther 2460 — 7y
Ad

Answer this question