top of page

Learn to damage and heal your Roblox players

Updated: Jun 3, 2023


thumbnail for blog article about healing and damaging your player in roblox studio
Learn to damage and heal your roblox players

A Healing Pickup


A healing pick up lets you restore some of your players health if they have lost any during your game. To create and test a pickup we must then have a way to damage our player so they can run over the pickup and restore their health.


Create some lava

A quick method of damaging the player is to create a lava part that delivers damage to the characters Humanoid. After we add a script to our lava part, and create a Touched event we can use the TakeDamage() method on the humanoid to damage the character each time they run over the lava.

Humanoid:TakeDamage(20)

Healing Pickup

The properties of the humanoid that we want to use are Health, and MaxHealth.


We can create a conditional statement that allows the player to pickup and heal if their health is less than their max health.

local amtToHeal = 20
if hum.Health < hum.MaxHealth then
	hum.Health += amtToHeal
end

This should be enough to test. Play the game and run over the lava a couple of times to see their health bar decrease in the top right of the screen. Then run over the health pickups to restore the players health.


If you want to learn new and interesting ways to code your projects check out my courses. Click the links to Udemy or Skillshare to get the best price available.


50 views0 comments

Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page