I'm trying to make a damaging system. So I need to figure out how to damage a specific player through the server because I've recently learned that damaging through the client is just stupid. So to test difference methods of damaging I'm trying to damage the player when they join the game. Here is one of my attempts below:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local Humanoid = player.name
Humanoid.Health = Humanoid.Health - 5
end)
I tried this because of the Humanoid.Health property. And I chose to use the players name as the humanoid because I read from an article that you can fetch the Humanoid by getting the players name.
So yeah, feel free to roast or lecture me below, it'll help out a lot.

2 comments
I tested this out and it gives me an error that says "attempt to index nil with 'Humanoid'". Any thoughts? Thanks for trying to help out though.
Never mind I've found a different solution. Thank you so much for your help either way because I've learned something from this.