I have no idea why, it should be returning true, but in the console it keeps returning false. They are then student team so they should be being moved to the dead team.
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then local baddie = game.Players:GetPlayerFromCharacter(humanoid.Parent) print(baddie.TeamColor == game.Teams.Students) if baddie.TeamColor == game.Teams.Students then local Pos = workspace.lobby.LobbyTele --Gets the Part to teleport to. local character = humanoid.Parent local player = game.Players:GetPlayerFromCharacter(character) player.TeamColor = game.Teams["Dead"].TeamColor part.Parent:moveTo(Pos.Position) wait(0) workspace.lobby.LobbyTele.Locked = false script.dead:Play() end wait(1) end end script.Parent.Touched:connect(onTouch)
The problem is that you are trying to compare a Color
value with a Team
value.
You want to check that the colors are the same, so compare the player's team color with the color value associated with the Students team:
local studentTeam = game.Teams.Students if baddie.TeamColor == studentTeam.TeamColor then -- code end
Hope this helps! :)