Untitled
Anonymous
plain_text
05/30/2023 1:03 PM
584 B
14
Indexable
local player = game.Players.LocalPlayer local maxHealth = 100 local currentHealth = maxHealth function onHit(damage) currentHealth = currentHealth - damage if currentHealth <= 0 then die() end end function die() -- add code here to handle player death end function onSpawn() currentHealth = maxHealth end -- connect the functions to events player.CharacterAdded:Connect(onSpawn) player.Character.Humanoid.HealthChanged:Connect(onHit)
Editor is loading...