For i,v in pairs error

Hey I’ve released my game yesterday but I have this strange bug lol

for i, v in pairs(game:GetService("Workspace").Folder951:GetChildren()) do
	if v:FindFirstChild("Model_G!342A") then
		v.Humanoid.Health /= 2
	else
		warn("No Model_G!342A found.")
	end
end

The bug is that it keeps printing the “No Model_G!342A Found” but in the Folder951 there are clearly the models.

Any help is appreciated thanks

Show explorer​​​​​​​​​​​​​​​​​

Does this work?

for i, v in pairs(game:GetService("Workspace").Folder951:GetChildren()) do
	if v.Name == "Model_G!342A" then
		v.Humanoid.Health /= 2
	else
		warn("No Model_G!342A found.")
	end
end
1 Like

Also, you will literally kill any developers with OCD if you do game:GetService(“Workspace”)
please use

workspace.Folder951:GetChildren()

workspace is also more efficient compared to game.Workspace.

Worked! Thanks. :slight_smile:

Glad I fixed this