Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)



2 comments

0

holy crap your organization is badddd

0

Try “game.Teams.Students.TeamColor”.

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.