How do I apply a script to a zombie so that when it changes the number of lives it is shown in the BillboardGui above its head? I made them visible, but they are always visible, and I need them to be shown when taking damage
local zombie = script.Parent.Parent.Parent.Zombie
while true do script.Parent.TextLabel.Text = zombie.Health wait() end
local Zombie = script.Parent -- so you need to do it inside of zombie, or put here your path local Hum = Zombie:WaitForChild("Humanoid") -- Humanoid or Zombie, look right local Billboard = Zombie.Head:WaitForChild("BillboardGui") -- the billboard gui with health Billboard.Enabled = false -- disable it for now
Hum:GetPropertyChangedSignal("Health"):Connect(function() -- check health changed Billboard.Enabled = true -- enable gui back Billboard.TextLabel.Text = Hum.Health -- change the Billboard's text to zombie's Hum() end)
local Zombie = script.Parent -- so you need to do it inside of zombie, or put here your path local Hum = zombie:WaitForChild("Humanoid") -- zombie's humanoid. change to yours local Billboard = Zombie.Head:WaitForChild("BillboardGui") -- the billboard gui with health Billboard.Enabled = false -- disable it for now Humanoid:GetPropertyChangedSignal("Health"):Connect(function() -- check health changed Billboard.Enabled = true -- enable gui back Billboard.TextLabel.Text = Humanoid.Health -- change the Billboard's text to zombie's health end)
That's basically all the code, hope it worked!!