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

Can I get a script that puts certian players on a team upon entry?

Asked by 10 years ago

I've tried every possible script that I know, and it still isn't working.

4 answers

Log in to vote
0
Answered by 10 years ago

Easy, no script involved. Just go in the teams properties, and check "Auto-assignable" The players will automatically go to that team upon entry, assuming it is the only one with Auto-assignable checked.

Ad
Log in to vote
0
Answered by 10 years ago

I mean, one player goes on a certian team. Lets say I [Overlord] want to go on Nafaria's team. What script would I need to have, to make me go on that team, [non auto assignable]. Upon entry

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

Make a table with set players you want on that team upon entry, use a pairs loop to check if the new entry matches any entry in the table, if so then change their TeamColor.

Players = {"OverlordRevolution","Goulstem","Friend","A Doge"}

game.Players.PlayerAdded:connect(function(plr)
    plr:WaitForDataReady()
    for i,v in pairs(Players) do
        if v == plr.Name then
            plr.TeamColor = BrickColor.new("Team Color Wanted Here")
        end
    end
end)

Hope I Helped

+1

Log in to vote
0
Answered by 10 years ago

Ok, if you mean for certain players then;

wait(0)
local List={"Player1","Player2","Player3"}
local plr=game:service("Players").LocalPlayer
repeat wait(0)until plr
for i=1,#List do
if plr.Name:lower()==List[i] then
plr.TeamColor=BrickColor.new("Whatever Color")
elseif not plr.Name:lower()==List[i] then
plr.TeamColor=BrickColor.new("Whatever Color")
end

Or you mean for a Group then;

wait(0)
local ID=0000000
local plr=game:service("Players").LocalPlayer
repeat wait(0)until plr
if plr:IsInGroup(ID)then
plr.TeamColor=BrickColor.new("Whatever Color")
elseif not plr:IsInGroup(ID)then
plr.TeamColor=BrickColor.new("Whatever Color")
end

I hope this helped!

Answer this question