01 | -- "Use()" is a function that does work, although the script recognizing which team the player is in does not work for some reason, it gets to the "else" instead. |
02 | -- LocalScript |
03 | player = game.Players.LocalPlayer |
04 |
05 | while wait() do |
06 | if player.Character.Humanoid.Health = = 0 then |
07 | if player.TeamColor = = "Bright red" then |
08 | Use( "Droid" ) |
09 | else |
10 | Use( "Human" ) |
11 | end |
12 | wait( 5 ) |
13 | end |
14 | end |
BrickColors are not strings. They are their own DataTypes:
if player.TeamColor == BrickColor.new('Bright red') then
Also, you don't need to use a loop for that. This is much more efficient:
01 | local player = game.Players.LocalPlayer |
02 | local character = player.Character |
03 | if not character or not character.Parent then |
04 | character = player.CharacterAdded:wait() |
05 | end |
06 | local humanoid = character:WaitForChild( 'Humanoid' ) |
07 |
08 | humanoid.Died:connect( function () |
09 | -- code |
10 | end ) |