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

Return and save the number of a humanoid's health property?

I'm looking to save the current value of a target's health as a variable, but I don't want that variable to update as his health regenerates or changes. I'm still pretty new to scripting, but is there any way I can save a targets health as a static number that will not change?

2 comments

0

local Health = Humanoid.Health, variables don't update on their own.

0

^

1 answer

Yes, here is an example :

local Humanoid = Target:WaitForChild("Humanoid") -- Target being the model that the humanoid is located in

local HealthVariable


Humanoid.HealthChanged:Connect(function(currentHealth)
       HealthVariable = currentHealth
end)

and if you want to have it saved forever I recommend looking into DataStore

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