Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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.

Ad
Log in to vote
1
Answered by 9 years ago
Game.Players.PlayerAdded:connect(function(plr)
print(plr.Name.." has joined the server!")
end
0
That should work for you AllianceScripter 30 — 9y
0
thanks! TroytheDestroyer 75 — 9y

Answer this question