script.Parent.Text = "Welcome" .. game.Players.LocalPlayer.Name.. "!"
Why wont it put the players name it just says nil
script.Parent.Text = "Welcome" .. game.Players.LocalPlayer.Name.. "!"
Why wont it put the players name it just says nil
Use a localscript, as game.Players.LocalPlayer can only be accessed that way! Also, I recommend changing "Welcome" to "Welcome, "
You do not need to reference the local player because your not setting any properties in a local scripts like characters,tools etc to fix this do.
NOTE: Make sure it's server sided
game.Players.PlayerAdded:Connect(function(player)
print("A player has entered: " .. player.Name)
end)
I'm going to assume that the welcome message is only supposed to show up for the player it's welcoming, so I think it should be swapped with a Local Script instead.
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
is it a local script or a regular script
Regular
Use a localscript!
Regular scripts, or formally "ServerScripts", are run on ROBLOX's Servers out in San Mateo, California. A LocalScript is operated on the Local Machine—Client (Your computer)—with the Roblox Player application. The LocalScript can only understand who the LocalPlayer is as it knows which Client it's running on. The Server cannot contain a LocalPlayer either as it is isn't a Player, but a machine man