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

How do i change players' team locally in a server script?

Asked by 5 years ago

I've tried multiple ways to change the teams of players inside a table inside of a model but the only ways I've had to do that was locally which wouldn't work in a server script that I can only use. How can I make it work? Here are some of my attempts:

for _, player in pairs(script.Parent.Parent.Parent.Parent.Parent.PlayersTouching:GetChildren()) do
    player.TeamColor = BrickColor.new("Sea green")
end

.

for i,v in pairs(script.Parent.Parent.Parent.Parent.Parent.PlayersTouching:GetChildren()) do
    v.TeamColor = BrickColor.new("Sea green")
end

.

local players = game:GetService("Players")
                for i,v in pairs(script.Parent.Parent.Parent.Parent.Parent.PlayersTouching:GetChildren()) do
                    if v.Parent:FindFirstChild("Humanoid") then
                        players:GetPlayerFromCharacter(v.Parent)
                        v.TeamColor = BrickColor.new("Sea green")
    end
end

0
oh my god so many parents User#19524 175 — 5y

Answer this question