Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

1 comment

0

Remember to click the accept answer button to give reputation to the person who helped to answer your question.

1 answer

✓ Accepted answer

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)

1 comment

0

Thank you. That helped me a lot.

This discussion is preserved as it was. New answers, comments, and votes are closed.