My script is supposed to check if a player is a certain team to prevent players from going into the opposite teams base, but it just throws a error and does nothing.
Team is not a valid member of player
script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player.Team == "Bright red Team" then player:BreakJoints() end end)
It's TeamColor, and TeamColor is a BrickColor value, you don't use the name. Also, You cannot call breakjoints on the player, but on the character instead.
script.Parent.Touched:connect(function(hit) local h = hit.Parent:WaitForChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player.TeamColor == BrickColor.new("Bright red") then player.Character:BreakJoints() end end)
Hope it helps!