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

Can you help me with my playername specific auto team script? [SOLVED]

Asked by 6 years ago
Edited 6 years ago

I need help I tried to make an auto team script but everytime they get set onto the wrong team. Can you tell me what I did wrong?

Great regards, Luigi.

local Teams = game:GetService("Teams")

game.Players.PlayerAdded:connect(function(plr)
    if plr.Name == "luigicrafter2" then
        plr.Team = Teams.Owner
    elseif plr.Name == "Greticrafter2" then
        plr.Team = Teams.CoOwner
    elseif plr.Name == "OrangenFeuer44" or "2014patrick" or "luigicrafter4" then
        plr.Team = Teams.Staff
    else
        plr.Team = Teams.Player
    end
end)
0
Remember to click the accept answer button to give reputation to the person who helped to answer your question. OldPalHappy 1477 — 6y

1 answer

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago

If you use or, you must re-add the thing that you are checking, otherwise if it is just the string it'll always be true.

local Teams = game:GetService("Teams")

game.Players.PlayerAdded:connect(function(plr)
    if plr.Name == "luigicrafter2" then
        plr.Team = Teams.Owner
    elseif plr.Name == "Greticrafter2" then
        plr.Team = Teams.CoOwner
    elseif plr.Name == "OrangenFeuer44" or plr.Name == "2014patrick" or plr.Name == "luigicrafter4" then
        plr.Team = Teams.Staff
    else
        plr.Team = Teams.Player
    end
end)
0
Thank you. That helped me a lot. luigicrafter2 7 — 6y
Ad

Answer this question