how do i make it so this healthbar takes damage when an npc touches it? i have 2 frames on top of eachother, a green frame named CurrentHealth (which is the green bar thats supposed to shrink to the left) and MaxHealth (which is a red frame thats static behind the green bar). this is my first project and i still have to learn alot. ive tried to use AI and tutorials but it doesnt seem to work. also, i need the npc to die when it touches the gate too. help would be much appreciated!!
#Healthbar on a part
11 messages · Page 1 of 1 (latest)
local healthChange = Health/MaxHealth
local size = UDim2.new(healthChange,0,1,0)
this should always update the health bar to its current stats, you are tracking the health in a different variable right?
no im not tracking the health, i only made the healthbar so far. i barely know anything abt scripting rn i just started making this game a day ago
** You are now Level 1! **
UI's are only for displaying, you should have the actual stats before displaying them
we cannot create a health bar without the health, can we?
ye ur right. but how would i get the stats ?
i want it to take dmg when an npc touches it
that is a whole different story, first you will have to create a number value instance. put it inside the base, and then you'll need to script the zombie to lower that value by its own health when it touches it
** You are now Level 16! **
if you want to improve on scripting, I'd say start with a simpler project. There are tutorials on youtube you can follow