heres what i got no errors when i run it but it wont display!
local Players = game:GetService("Players") local player = Players.LocalPlayer function onPlayerAdded(players) script.Parent.Text = player.Name end
heres what i got no errors when i run it but it wont display!
local Players = game:GetService("Players") local player = Players.LocalPlayer function onPlayerAdded(players) script.Parent.Text = player.Name end
If you want the LocalPlayers name in a TextBox, use the code below.
local TextBox = script.Parent
TextBox.Text = game.Players.LocalPlayer.Name
If you want the Text to change everytime a new player joins, use the code below.
local Players = game:GetService('Players')
local TextBox = script.Parent
Players.PlayerAdded:Connect(function(plr)
TextBox.Text = plr.Name
end)
I wasn't completely sure what you wanted, giving the code you provided didn't make much sense. Both scripts I provided should work.
Also, make sure you're using a LocalScript when changing objects in StarterGui!
3 answers ppl were faster than me writing in 3 minutes. just. wow. :/ jk
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
What kind of gui are you using to display the name?
please use a code block.
also, are you running the function??