Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
SxnWyd 5
6 years ago
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

Log in to vote
0
Answered by 6 years ago

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

Ad
Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago
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".

Answer this question