-- "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. -- LocalScript player = game.Players.LocalPlayer while wait() do if player.Character.Humanoid.Health == 0 then if player.TeamColor == "Bright red" then Use("Droid") else Use("Human") end wait(5) end 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:
local player = game.Players.LocalPlayer local character = player.Character if not character or not character.Parent then character = player.CharacterAdded:wait() end local humanoid = character:WaitForChild('Humanoid') humanoid.Died:connect(function() -- code end)