I used:
local hum = script.Parent:WaitForChild("Humanoid")
hum.HealthChanged:Connect(function()
hum.Health = hum.MaxHealth
end)
I was just wondering if this is the most optimal way of doing this, however it might have some problems such as if it takes more than its MaxHealth which I can fix by just increasing it to a larger number.
Thanks!

2 comments
ForceField
Pretty sure you can just set the MaxHealth to "inf" and then copy paste the max health into the health to get a humanoid with infinite health and it doesnt require scripting