Hello! I'm back with another question that. So, I'm looking to get a specific player, and when I find them do something with their avatar (This is something I can do myself) but, I'm confused on how to get the player. For example, Lets say I want to get my own user, so when I join I would get my avatar changed. How would I detect that "Pokemine1o9" Has joined, and not just any random player? Thanks for the help :)
✓ ANSWER ACCEPTED
How do I get a specific player upon them joining the game?
3 answers
✓ Accepted answer
local players = game:GetService("Players")
local specialUsers = {
[74109617] = "pokemine1o9"
}
local function notifySpecialUserEntry(playerJoined)
if (specialUsers[playerJoined.UserId]) then
print(playerJoined.Name.." has joined the game!")
end
end
players.PlayerAdded:Connect(notifySpecialUserEntry)
You would do:
Game.players.playeradded:connect(function(plr)
If plr == “yourname” then
Do thing
End
End)
game.Player.PlayerAdded:Connect(function(player)
if player.Name = "Pokemine1o9" then
--what u want to do with the char but remember get the char first for example
local plr = game.Players.Pokemine1o9
local char = plr.Character
-- then do what u need to do to the character by using the char variable if u want to change their avatar because player is not a object you need to get it from workspace
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
