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.
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
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.