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

Help on A for loop??

players = game.Players:GetPlayers()
for i,v in pairs(players) do
				check = game.Workspace:findFirstChild(v.Name)
				if check then
					hum = game.Workspace:findFirstChild(check)
					if hum then
						v.Character.Humanoid.Health = 0
					end

2 comments

0

Where are all your ends?

0

I put theme all but it still dont work :/

1 answer

Line 5~

It says hum = game.Workspace:findFirstChild(check). It should be something like hum = check:findFirstChild("Humanoid")

You also forgot some ends.

Altogether, it should look something like...

players = game.Players:GetPlayers()
for i,v in pairs(players) do
	check = game.Workspace:findFirstChild(v.Name)
	if check then
		hum = check:findFirstChild("Humanoid")
		if hum then
			v.Character.Humanoid.Health = 0
		end
	end
end

Oh, and if you just want to kill everyone...

Players = game:service("Players")
for i, v in pairs(Players:GetPlayers()) do
pcall(function()
v.Character.Humanoid.Health = 0
end)
end

Well, hope this was helpful at all....

  • Kratos232

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