Why is this tween only only run once?

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)
1 Like

If it doesn’t return any errors check your connections for the remote event

2 Likes

by connections do you mean other scripts using it? if not could you please elaborate

1 Like

Any event has :Connect to it, this actually tells the script to listen for any requests to that particular item

If your connection is disconnected then the script will not listen to any inbound requests

1 Like

wouldnt that connection stop running the code although? its still running all the functions.

1 Like

If it still prints cheese then the connection still exists
If your problem is that after resetting the bar doesn’t move It’s because when you respawn you get a new character meaning new humanoid which the script doesn’t pick up on and continues using the still non existent old humanoid instance

2 Likes

that wouldnt be the problem sence i havent reseted at all im thinking this will be a internal problem instead of external. also after it tweens once it wont tween anymore after is the problem.

1 Like

Theres no reason to handle this on the server, handle it all in client.

1 Like

i need it to be able to be seen by everyone.

it was a issue with my math, thanks to everyone who helped.