Here's what I've got so far, but it just doesn't work. According to the Print()'s I used, it should work. Can anyone tell me what I'm doing wrong here?
1 | if _G.Block.LastCharacter then |
2 | print (_G.Block.LastCharacter) -- Prints 'Player1' (character) |
3 | local team = game.Players:GetPlayerFromCharacter(_G.Block.LastCharacter).TeamColor |
4 | print (team) -- Prints 'Really blue' |
5 | if team = = "Really blue" then print ( "Found" ) end -- Still nothing |
6 | end |
Alright, it turned out to be a mistake I made when trying to compare. TeamColor uses the BrickColor data type. So I have to use the Name
property to make it run properly.
1 | if _G.Block.LastCharacter then |
2 | print (_G.Block.LastCharacter) -- Prints 'Player1' (character) |
3 | local team = game.Players:GetPlayerFromCharacter(_G.Block.LastCharacter).TeamColor |
4 | print (team) -- Prints 'Really blue' |
5 | if team.Name = = "Really blue" then print ( "hit" ) end |
6 | end |