#HealthBar Like system not working

1 messages · Page 1 of 1 (latest)

shut elbow
#

I have another script in my game that adds a custom healthbar that tweens when the players health changes, i tried remaking the same GUI but with a "morale" intvalue instead of the health value but for some reason it does not change the bar at all

#

`local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local frame = script.Parent
local healthBar = script.Parent.Health
healthBar.Size = UDim2.new(1, 0, 1, 0) -- Full size initially

local TweenService = game:GetService("TweenService")

local function updateHealthBar()
local healthPercent = script.Parent.Morale.Value / 100
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local goal = {Size = UDim2.new(healthPercent, 0, 1, 0)}
local tween = TweenService:Create(healthBar, tweenInfo, goal)
tween:Play()
end

humanoid.HealthChanged:Connect(updateHealthBar)
updateHealthBar() -- Initial update

`

proud stirrup
shut elbow
#

oh didnt quite catch that, thank you!

#

although when i replace it with
morale.Changed:Connect(updateHealthBar)
it doesnt really do anything still

vagrant skiffBOT
#

studio** You are now Level 1! **studio

proud stirrup
shut elbow
#

yeah the value is in the GUI, is it not gonna work that way?

proud stirrup
pliant tiger
pliant tiger