Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does it keep returning false when I ask for the team?

Asked by 5 years ago

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)
0
holy crap your organization is badddd iRoklas 1 — 5y
0
Try “game.Teams.Students.TeamColor”. User#20279 0 — 5y

1 answer

Log in to vote
0
Answered by
chomboghai 2044 Moderation Voter Community Moderator
5 years ago

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! :)

Ad

Answer this question