im making a overhead healthbar and i have a remote event system set up for it and the local script fires to the client if the humanoids health changes then it runs the function in the script. it works but only one time if i change the health again it dosent tween. ive already clairifyed that both functions are running with a print statment. but its not tweening after the first time?
server script
local rep = game.ReplicatedStorage.ChangeHealth
local char = script.Parent
local healthgui = script:WaitForChild("OverHeadGui")
local hum = char:WaitForChild("Humanoid")
healthgui.Parent = char:WaitForChild("Head")
local TW = game:GetService("TweenService")
local function UpdateHealthbar()
print("cheese")
local health = math.clamp(hum.Health / hum.MaxHealth, 0, 0.3) --Maths
local info = TweenInfo.new(hum.Health / hum.MaxHealth,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --Tween Info
TW:Create(healthgui.PlayerBar.Frame,info,{Size = UDim2.fromScale(health, 0.3)}):Play() -- Create The Tween Then Play It
end
rep.OnServerEvent:Connect(UpdateHealthbar)
local script
local player = game.Players.LocalPlayer
local char = player.Character
local hum = char:WaitForChild("Humanoid")
--script.Parent.OverHeadGui.PlayerToHideFrom = player
local rep = game.ReplicatedStorage.ChangeHealth
hum:GetPropertyChangedSignal("Health"):Connect(function()
rep:FireServer()
print("fired")
end)
hum:GetPropertyChangedSignal("MaxHealth"):Connect(function()
rep:FireServer()
print("fired")
end)