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 6 years ago

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

game.Players.PlayerAdded:connect(function(p)
    if game.StarterGui.plrlist.Frame.plr.Text == " " then
        game.StarterGui.plrlist.Frame.plr.Text = p.Name
        game.StarterGui.plrlist.Frame.plr.Name = p.Name
    end
end)

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 6 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.)

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

Label.Text = Player.Name
Label.Name = Player.Name

Hope I helped!

~TDP

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

Answer this question