Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to update a player's starter gui?

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..StarterGui.

1 answer

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

2 comments

0

Um... I tried it and it didn't work

0

What was the error in the output?

This discussion is preserved as it was. New answers, comments, and votes are closed.