Why does my team script not work? I am trying to make a millitary rp game and this is one of the last things I need to start it up. So please tell me what to do. Should I use team colors instead of the name?
game.Players.PlayerAdded:connect(function(player) if player:GetRankInGroup(2583379) == 1 then player.Team = "Recruit" elseif player:GetRankInGroup(2583379) >= 5 then player.Team = "1st Marine Division" else end
game.Players.PlayerAdded:connect(function(player) if player:GetRankInGroup(5983199) == 1 then player.TeamColor = BrickColor.new("Medium stone grey")--change this to the color of the recruit team elseif player:GetRankInGroup(5983199) >= 5 then player.TeamColor = BrickColor.new("Earth green")--change this to the color of the marine division tea else end end)
If you want to change a players team you usually change the color, so it might look like this
game.Players.PlayerAdded:connect(function(player) if player:GetRankInGroup(2583379) == 1 then player.TeamColor = BrickColor.new("")--change this to the color of the recruit team elseif player:GetRankInGroup(2583379) >= 5 then player.TeamColor = BrickColor.new("")--change this to the color of the marine division team else end
As jediplocoon said you can use TeamColor
. But if you want to change a player's Team using Team
. You don't set it equal to the Team Name. You specifically point out the Team. Like in the example below.
local Teams = game:GetService("Teams") local recruit = Teams:WaitForChild("Recruit") local marine = Teams:WaitForChild("1st Marine Division") game.Players.PlayerAdded:connect(function(player) if player:GetRankInGroup(2583379) == 1 then player.Team = recruit elseif player:GetRankInGroup(2583379) >= 5 then player.Team = marine end end