no, im trying to make a test dummy that instantly heals as soon as it ‘dies’, and I dont want to use respawning. I’ve seen what im describing in a different game.
I think the only way is to respawn the dummy as fast as possible, you cant set the dummy to maxhp when the humanoid already died so do a script with a respawn delay of 0.1
If you group the dummy in a model and inside that model you put this script it should respawn it instantly.
local Model = script.Parent
local CurrentFigure = Model.Dummy
local Figure = CurrentFigure:Clone()
local RESPAWN_DELAY = 0.001
local CanSpawn = true
function Respawn()
wait(RESPAWN_DELAY)
CurrentFigure:Destroy()
CurrentFigure = Figure:Clone()
CurrentFigure:MakeJoints()
CurrentFigure.Parent = Model
CurrentFigure.Humanoid.Died:connect(onDied)
end
function onRemoved(Object)
if Object == CurrentFigure and CanSpawn then
Respawn()
end
end
function onDied()
if CanSpawn then
CanSpawn = false
Respawn()
CanSpawn = true
end
end
CurrentFigure.Humanoid.Died:connect(onDied)
Model.ChildRemoved:connect(onRemoved)