Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to keep a humanoid from taking damage?

In my game I want no chance that players can take damage, but I don't want to use forcefields. Is there a different way to keep the humanoid from taking damage? I tried using

Humanoid:GetPropertyChangedSignal("Health")

and updating it every time it's not at 100 but nothing happens. Neither does looping and checking if it's at 100.

1 answer

Hey. Try this:

local Humanoid = script.Parent.Humanoid

Humanoid.Changed:Connect(function(property)
    if tostring(property) == "Health" then

       local maxHealth = 100

       Humanoid.Health = tonumber(maxHealth)
   end
end)

3 comments

0

Not working. I'm putting the script in starercharacterscripts

0

Because we didn't define 'Humanoid'. Check out the updated answer^

0

Because we didn't define 'Humanoid'. Check out the updated answer^

This discussion is preserved as it was. New answers, comments, and votes are closed.