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?
if _G.Block.LastCharacter then print(_G.Block.LastCharacter) -- Prints 'Player1' (character) local team = game.Players:GetPlayerFromCharacter(_G.Block.LastCharacter).TeamColor print(team) -- Prints 'Really blue' if team == "Really blue" then print("Found") end -- Still nothing 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.
if _G.Block.LastCharacter then print(_G.Block.LastCharacter) -- Prints 'Player1' (character) local team = game.Players:GetPlayerFromCharacter(_G.Block.LastCharacter).TeamColor print(team) -- Prints 'Really blue' if team.Name == "Really blue" then print("hit") end end