Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you get the name of a player and print it in the output?

I'm trying to do something like Jojomen did with his "Honey Madness" game. I want to detect if a player joins then print their name in the output. here's my code I can't seem to get right:

game.Players.PlayerAdded =
Player:Get("Name") -- a little worried this part won't work.
 -- what do I put here?
print(game.Players.LocalPlayer.Name..'has joined this server.')

The problem is I don't know how to get the player's name. and the


print(game.Players.LocalPlayer.Name..'has joined this server.')

probably won't work. Anyone know how to fix this?

2 answers

✓ Accepted answer

I would put it into a function.

game.Players.PlayerAdded:connect(function(p)
print(p.Name .." has joined the server!")
end

Basically what Alliance said.

Game.Players.PlayerAdded:connect(function(plr)
print(plr.Name.." has joined the server!")
end

2 comments

0

That should work for you

0

thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.