I'm trying to make a local script detect what the teams are, the colors of the teams "NATO" Bright blue and "OPFOR" Bright red. So what's the problem with this?
if script.Parent.Parent.Team=="NATO" then script.Parent.Scripts.PlayerRig.Disabled=true script.Parent.Scripts.PlayerRig2.Disabled=false wait(0) script.Parent.Scripts.Animate.Disabled=false script.Parent.Scripts.HatAnimationSoundRemover=false elseif script.Parent.Parent.Team=="OPFOR" then script.Parent.Scripts.PlayerRig.Disabled=false script.Parent.Scripts.PlayerRig2.Disabled=true wait(0) script.Parent.Scripts.Animate.Disabled=false script.Parent.Scripts.HatAnimationSoundRemover=false end
Assuming you're actually attempting to use player.TeamColor, not player.Team, you can do it like this:
local teams = { ["NATO"] = BrickColor.new("Bright blue"); -- Optionally BrickColor.Blue() ["OPFOR"] = BrickColor.new("Bright red"); -- BrickColor.Red() returns Really red. } if script.Parent.Parent.TeamColor == teams["NATO"] then script.Parent.Scripts.PlayerRig.Disabled = true script.Parent.Scripts.PlayerRig2.Disabled = false elseif script.Parent.Parent.TeamColor == teams["OPFOR"] then script.Parent.Scripts.PlayerRig.Disabled = false script.Parent.Scripts.PlayerRig2.Disabled = true end -- Moved these two lines down here, as they both happen in both incidents. However, if you have several teams and you only want this applied to these two teams, you'll have to move it back. script.Parent.Scripts.Animate.Disabled = false script.Parent.Scripts.HatAnimationSoundRemover = false
If script.Parent.Parent is the Player, and this is a LocalScript, I advise you to assign a variable to game.Players.LocalPlayer, rather than jumping through the hierarchy all the time!