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

Trying to get the teamColor of player but not working?

Asked by 7 years ago

So when they touch a part in workspace I want the script to check if the player is in a certain team, if so then take their cframe and put it on the other side of the door. Thing is I don't think I am finding the players team Color properly. Yes, this is a server script.


script.Parent.Touched:connect(function(hit) print("Yes") local player = game.Players:GetPlayerFromCharacter(hit.Parent) print("Just random words") if player then print("Getting better") if player.Team.TeamColor == "Bright Red" then print("Found color") print("Apart of this dorm") hit.Parent.Torso.CFrame = script.Parent.CFrame + Vector3.new(0,0,5) end end end)
0
if player.Team.TeamColor == "Bright Red" then should be if player.TeamColor == BrickColor.new("Bright red") then Decemus 141 — 7y

1 answer

Log in to vote
1
Answered by
Link150 1355 Badge of Merit Moderation Voter
7 years ago

You cannot compare a BrickColor to a string directly.

Instead, you must either compare the BrickColor's Name component to a string or compare two BrickColors together.

if myColor.Name == "Bright red" then
    -- Do something...
end
if myColor == BrickColor.new("Bright red") then
    -- Do something...
end
Ad

Answer this question