Label doesn't update itself in StarterGUI upon spawn

I want the label to display certain text, but it doesn’t.
I am using a local script and it still doesn’t work, I am unsure if there’s an error in my code.

Here’s the script:

local Players = game:GetService("Players")
local ThingText = game.StarterGui.IfPlayerJoined.Frame.TextJoin

Players.PlayerAdded:Connect(function(player)
	ThingText.Text = "Welcome, " .. player.Name
end)

You can just use game:GetService("Players").LocalPlayer as its in a localscript
Also, you defined the StarterGui and not the PlayerGui

local Player = game:GetService("Players").LocalPlayer
local ThingText = script.Parent --set to wherever your textlabel is

ThingText.Text = "Welcome, " .. Player.Name
1 Like

Ok so using player.PlayerAdded in a local script is POINTLESS a local script only runs when a player joins
so if you were to do

Local Script

print("Hello Roblox! I just joined!")

Server Script

game.Players.PlayerAdded:Connect(function(Player)
	print("Hello Roblox! "..Player.Name.." just joined!")
end)

It would in practical and theory print both those thing at the exact second. It wont have millisecond accuracy though. But still! So yea.


And be sure to make @ShyFlooo’s reply as solution. I just explained more : )

1 Like