I made this basic script and it keeps saying Attempt to index nil with 'Humanoid'
Help please
game.Players.PlayerAdded:Connect(function(plr)
plr.Character.Humanoid.Health = 0
end)
I made this basic script and it keeps saying Attempt to index nil with 'Humanoid'
Help please
game.Players.PlayerAdded:Connect(function(plr)
plr.Character.Humanoid.Health = 0
end)
All I had to do was this:
game.Players.PlayerAdded:Connect(function(plr) wait(0.01) -- Add this plr.Character.Humanoid.Health = 0 end)
When you try to find Humanoid you need to wait till the players connect and load. So yea adding a wait would fix the problem because scripts load first.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Why not plr.Character:WaitForChild("Humanoid").Health = 0? It will yield until Humanoid exists