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

Find Specific players?

Asked by 9 years ago

So I am making a team changing script and I want to so that when I join it throws me on a team called Teacher. I already know how to do that but I was wondering if

if Players.conman0552

would work. I have tried this many times and have even tried to just get the character. Please help me.

0
So considering I answered your question first and my script works just fine, you should except my answer (: or at least like it (: please? I like points. The other guy basically copied my answer anyway :P User#11440 120 — 9y
0
Ya but yours is inefficient and such. Conmmander 479 — 9y

4 answers

Log in to vote
3
Answered by 9 years ago

You can use tables for detecting multiple users.

Example

admins = {
["BluDev"] = true;
["Friend"] = true
}

game.Players.PlayerAdded:connect(function(player)
    if admins[player.Name] then
        --put any code you want here
    end
end)

Table Help:



admins = { ["NAME HERE"] = true; ["NAME HERE"] = true }

The list can go on however long you want.

Example Script:

admins = {
["BluDev"] = true;
["Friend"] = true;
["Player"] = true;
}


game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        if admins[player.Name] then
            print(player.Name.." is an admin of this game")
            char:WaitForChild("Humanoid").MaxHealth = 500
            char:WaitForChild("Humanoid").Health = 500
        end
    end)
end)
Ad
Log in to vote
2
Answered by
ausmel105 140
9 years ago

What wfvj014 posted would work, however I prefer using "UserId" as an identifier. To do so, use the code below:

game.Players.PlayerAdded:connect(function(player)
    if player.UserId == 81482246 then
        player.TeamColor = BrickColor.new("White") -- Color of team.
    end
end)

Happy scripting!

0
Lol, one up me will you. User#11440 120 — 9y
Log in to vote
-1
Answered by 9 years ago

Well, you should make sure to add this to a player added function,

game.Players.PlayerAdded:connect(function(player)
   if player.Name == "WillyBottom" then
      ---Stuff here
   end
end)

Good luck!

Log in to vote
-3
Answered by 9 years ago

maybe this:

if Players.conman0552 = true then

0
This wouldn't work. You need a function to check if the player is the person. You would also want to use find first child and == two equals :P User#11440 120 — 9y

Answer this question