Why are these teams not equal?
Asked by
5 years ago Edited 5 years ago
So basically, I have a player whose team is Red. And then there's a soldier whose team is also Red. In this short script I want to compare the teams. I tested this script in team Red and right clicked on this soldier and for some reason it does not print out "Selected by same team!" And it DOES print out for print(hitterTeam) and print(soldierTeam) Red. And it also prints out "false" for print(selected). I wanna know why hitterTeam is not equal to soldierTeam.
01 | humanoid = script.Parent |
02 | soldier = humanoid.Parent |
03 | soldierTeam = soldier.Team.Value |
04 | cd = soldier.ClickDetector |
07 | cd.RightMouseClick:connect( function (hitter) |
08 | local hitterTeam = hitter.Team |
11 | while selected = = false do |
14 | if hitterTeam = = soldierTeam then |
15 | print ( "Selected by same team!" ) |
For more context, questions will be answered!
Also...
even without the while loop, it would still not work!