Script:
game.Players.PlayerAdded:connect(function(player) player.Character.Head:remove() end)
I just want the player to die when they first join and I am getting this error: Workspace.PlayerAdded:3: attempt to index field 'Character' (a nil value)
Please help! Thanks.
Your script running before player character even spawns. You must add repeat
loop into first function, and then wait until character head loads. Or you can wait for Humanoid and set health to 0 (alternate killing way)
game.Players.PlayerAdded:connect(function(player) repeat wait() until player.Character char = player.Character char:WaitForChild("Head"):Destroy() --Wait until head creates, and then destroy it. end)
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = 0 end end)