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

1if 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

01admins = {
02["BluDev"] = true;
03["Friend"] = true
04}
05 
06game.Players.PlayerAdded:connect(function(player)
07    if admins[player.Name] then
08        --put any code you want here
09    end
10end)

Table Help:

1admins = {
2["NAME HERE"] = true;
3["NAME HERE"] = true
4}

The list can go on however long you want.

Example Script:

01admins = {
02["BluDev"] = true;
03["Friend"] = true;
04["Player"] = true;
05}
06 
07 
08game.Players.PlayerAdded:connect(function(player)
09    player.CharacterAdded:connect(function(char)
10        if admins[player.Name] then
11            print(player.Name.." is an admin of this game")
12            char:WaitForChild("Humanoid").MaxHealth = 500
13            char:WaitForChild("Humanoid").Health = 500
14        end
15    end)
16end)
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:

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

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,

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

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