I want a player to be teleported away from a part if their team color doesn't match the part's color. Output says there is a problem with line 4, can anyone help me?
script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) wait() if player.TeamColor == BrickColor.new("Bright blue") or player.TeamColor == BrickColor.new("Really blue") and script.Parent.BrickColor == BrickColor.new("Bright green") then hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(-49,4,109)) elseif player.TeamColor == BrickColor.new("Bright green") or player.TeamColor == BrickColor.new("Camo") and script.Parent.BrickColor == BrickColor.new("Bright blue") then hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(-49,4,-79)) end end)
Try making "local player = " to "local player = game.Players.LocalPlayer" , add a wait(2) at line 1 and make it a local script
script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) wait() if player.TeamColor.BrickColor == BrickColor.new("Bright blue") or player.TeamColor.BrickColor == BrickColor.new("Really blue") and script.Parent.BrickColor == BrickColor.new("Bright green") then hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(-49,4,109)) elseif player.TeamColor.BrickColor == BrickColor.new("Bright green") or player.TeamColor.BrickColor == BrickColor.new("Camo") and script.Parent.BrickColor == BrickColor.new("Bright blue") then hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(-49,4,-79)) end end)