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(model.PlayersTouching:GetChildren()) do player.TeamColor = BrickColor.new("Sea green") end
.
for i,v in pairs(model.PlayersTouching:GetChildren()) do v.TeamColor = BrickColor.new("Sea green") end
.
local players = game:GetService("Players") for i,v in pairs(model.PlayersTouching:GetChildren()) do if v.Parent:FindFirstChild("Humanoid") then players:GetPlayerFromCharacter(v.Parent) v.TeamColor = BrickColor.new("Sea green") end end
If you want something to be done by the server but only show up locally, this is impossible. You will need to use a LocalScript to change the Player's team. You can alternatively use a RemoteEvent and :FireClient(player) to have a LocalScript change the team depending on what the Server sends the client.
For extra assistance, please contact me on Discord.
Bark#4260