I want to disable the default heal script and make my own
when you start your game in roblox studio you can see a Health script under your player
you can copy it into StarterCharacterScripts
and change it’s content to whatever you’d like
No but like the auto player heal?
that’s the player heal script.
This is the auto player heal. Inside this script you see a loop which heals 1/100th of the player’s health and it can be used to make custom healing effects.
Is it just a loop? Isn’t there a local script in starter player scripts for heal
Is there a way to disable the player downing with the script
Yes, I believe.
Not by default.
Would you mind elaborating on the term downing?
I think it was a autocorrect issue I think meant to say how to disable the default heal script for every player that spawns
A very common fix as written on the DevWiki is to simply place a script called “Health” in StarterCharacterScripts and make it empty or self deleting. This replaces the default heal script as Time has said in the first reply.
edit: here’s the sauce: (Humanoid.Health)
The default health rate per second is just only 1% of your health.
And you can’t disable it.
The character needs health to survive in-game.
Ik but I want to modify the heal rate
Insert a script into StarterCharacter called “Health”
Copy/Paste this code (default health script) into it:
-- Gradually regenerates the Humanoid's Health over time.
local REGEN_RATE = 1/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 1 -- Wait this long between each regeneration step.
--------------------------------------------------------------------------------
local Character = script.Parent
local Humanoid = Character:WaitForChild'Humanoid'
--------------------------------------------------------------------------------
while true do
while Humanoid.Health < Humanoid.MaxHealth do
local dt = wait(REGEN_STEP)
local dh = dt*REGEN_RATE*Humanoid.MaxHealth
Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
end
Humanoid.HealthChanged:Wait()
end
already noted on how to change
Incorrect, you can disable health regeneration.
How can I disable the default health script
Do what @0BSCURITY stated, and change the declaration of the variable REGEN_RATE
to 0
. See if this works.
I know but it resets everytime you die.
So it’s impossible to disable it.
You can still disable it because it gets replaced with the one in StarterCharacterScripts as long as they have the same name.
Does the script that is replacing has to have code or I just replace it with a blank script and then create another script that controls healing
It does not need code in order to disable the default Health
script. You can create your own Healing script using a separate script if you so choose.