I have a feeling I screwed up on Line 3 at the end. Can someone help me edit it? Thanks :)
game.Players.PlayerAdded:connect(function(player) Username = player.name game.Players.LocalPlayer.PlayerGui.PhoneGUI.Menu.Owner.Text = (Username) end)
Let's look at two scenarios.
1.) Using a local script
2.) Using a regular script
One issue with your code is that you can't use LocalPlayer and .PlayerAdded in the same script due to the simple fact that one only works in server-scripts
and one only works in localscripts
.
If this is a localscript, we can make the code to:
local plr = game.Players.LocalPlayer; local name = plr.Name; repeat until plr.ChildAdded:wait().Name == "PlayerGui" plr.PlayerGui.PhoneGui.Menu.Owner.Text = name;
In a regular script, we can do the following:
game.Players.PlayerAdded:connect(function(plr) local name = plr.Name; plr.PlayerGui.PhoneGui.Menu.Owner.Text = name; end)