So Ive been searching the web for about half an hour and I cant seem to find anything. I was wondeing if anyone knew how to enable and disable immortality?
COMMUNITY QUESTION
How to make a player unable to take damage?
2 answers
Have you tried force shield?
https://developer.roblox.com/en-us/api-reference/class/ForceField
Or try locking the health value in a variable and when health changes, turn the health to that value again (and disable death).
Try using the Changed event:
local immortalityEnabled = true
game.Players.PlayerAdded:Connect(function(player)
local CharHumanoid = player.Character
if immortalityEnabled then
CarHumanoid.Changed:Connect(function(property)
if property == "Health" then
CharHumanoid.Health = 100
end
end
end)
end)
I hope this helps!
1 comment
0
If it doesn't work, try using a 'while' loop.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Another way to do this is to set the maxhealth and health to math.huge