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

Can anyone find the errors in this piece of code? I cant find any errors. I need help?

local Players = game:GetService(“Players”):GetChildren()
function Choose()
   return Players [math.random(1,#Players)]
end
function AnnihilateRandom()
   local Player = Choose()
     local Hp = Player.Character.Humanoid.Health
       if Hp.Value >= 1 and Player.Name ~= "Ziffix" then
         Player.Character.Head:Destroy()
     else
         AnnihilateRandom()
     end
  end
end
while wait(1.5) do
   AnnihilateRandom()
end

cant find any errors, does anyone know the problem?

2 answers

I'm pretty sure that the Players service is their client and whatnot, while their physical bodies are in the workspace.

local Players = game:GetService(“Players”):GetChildren()
function Choose()
   return Players[math.random(1,#Players)] - was a space here. Not sure if it matters.
end
function AnnihilateRandom()
   local Player = Choose()
     local Hp = Player.Character.Humanoid.Health
       if Hp.Value >= 1 and Player.Name ~= "Ziffix" then
         Player.Character.Head:Destroy()
     else
         AnnihilateRandom()
     end
  end
end
while wait(1.5) do
   AnnihilateRandom()
end

Everything else should be fine. You probably don't see anything because your name isn't "Ziffix".

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