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

How do I make a script that detects when a certain player has joined?

Asked by 10 years ago

I want to make a script that detects if I joined or not, and if I do, it will change my team to a certain team. I just don't know how to do this...

3 answers

Log in to vote
1
Answered by 10 years ago
game.Players.PlayerAdded:connect(function(plr)
local p = plr.Name = "NickaalexTwo"
if p then
game.Players.NickaalexTwo.TeamColor = "COLOR NAME"
end)

Not sure if it will work i'm new to scripting.

Ad
Log in to vote
0
Answered by 10 years ago
local admins = {"NickaalexTwo"}

game.Players.PlayerAdded:connect(function(player)
    for _,v in pairs(admins:GetChildren()) do
        if v == player.Name then
            player.TeamColor = BrickColor.new("ColorName").Color -- I believe you need to add the .Color so that it will change the team color correctly.
        end
    end
end)
Log in to vote
-1
Answered by 10 years ago

You need a entered event, and then a print event. You could try to connect the two to a string. Join the game, and it prints the players name into a stringvalue.

Answer this question