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

How do I get a specific player upon them joining the game?

Asked by 3 years ago

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 :)

3 answers

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
3 years ago
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)
Ad
Log in to vote
0
Answered by 3 years ago

You would do:

Game.players.playeradded:connect(function(plr)
        If plr == “yourname” then
                Do thing
         End
End)
Log in to vote
0
Answered by 3 years ago
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)

Answer this question