Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make this script kill people who are in Bright red but have ZAnimate? [Unsolved!]

TheTeamColor = "Bright red" 
game.Players.ChildAdded:connect(function(player)
	wait(15)
if player.TeamColor == TheTeamColor then
if player.Character:findFirstChild("ZAnimate") then
	player.Character.Head.remove()
end

end
end)

1 answer

There are several flaws in your code. Let me correct them.

TheTeamColor = BrickColor.new("Bright red") 
game.Players.ChildAdded:connect(function(player)
wait(15)
if player.TeamColor == TheTeamColor then
if player.Character:FindFirstChild("ZAnimate") then
    player.Character.Head:Destroy()
end
end
end)

You had the following errors:

  1. Using "Bright red" instead of BrickColor.new("Bright red") on line 1. "Bright red" is a string, but player.TeamColor is a BrickColor.
  2. :findFirstChild instead of :FindFirstChild. You just should not use :findFirstChild anymore.
  3. .remove() First of all, you are telling to execute the player's head's remove(), but you are not telling it what to remove. The fix to this is :remove(). Secondly, you should not use :remove() anymore. Use :Destroy() instead, it works better.

This discussion is preserved as it was. New answers, comments, and votes are closed.