Hello,
I’m trying to set this text to the local player’s name via a local script, however, the text GUI doesn’t seem to be updating! Any help is appreciated.
The script:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
Players.PlayerAdded:Connect(function()
player.CharacterAdded:Connect(function(Character)
-- Sets welcome text
script.Parent.Main.Welcome.Text = "Welcome,".. player.Name .."!"
end)
end)
local Players = game:GetService("Players")
local player = Players.LocalPlayer
while wait(.1) do
Players.PlayerAdded:Connect(function()
player.CharacterAdded:Connect(function(Character)
-- Sets welcome text
script.Parent.Main.Welcome.Text = "Welcome,".. player.Character.Name .."!"
end)
end)
end
I’m pretty sure that game.Players.PlayerAdded only works server-side. My recommendation is to do this using remote events, or just setting the text with a script.
Also, your code has it so that when any player joins the game and loads their character, it says “Welcome, [localPlayer]” when any player joins, since you didn’t create a parameter for the newly joining player.
Yes, I know. That’s why the path game.Players[player].PlayerGui.Main.Welcome.Text goes to PlayerGui, because when the game loads, everything from StarterGui is cloned into PlayerGui, so, start up your game and verify where the gui is and then if possible could you send a screenshot of where it’s located in your game?