hum:GetAttributeCHangedSignal not working and refiring a function

Just like in the title hum:GetAttributeCHangedSignal isnt refiring a function i have in my module script, heres the code

local HMH = {}

function HMH.ListenForIncrease(hum : Humanoid, HeatIconClipping :Frame,HeatIconTop :ImageLabel, MaxHeat : number)
	local function resizeCustomLoadingBar(sizeRatio, clipping, top)
		clipping.Size = UDim2.new(sizeRatio, clipping.Size.X.Offset, clipping.Size.Y.Scale, clipping.Size.Y.Offset)
		top.Size = UDim2.new((sizeRatio > 0 and 1 / sizeRatio) or 0, top.Size.X.Offset, top.Size.Y.Scale, top.Size.Y.Offset) -- Extra check in place just to avoid doing 1 / 0 (which is undefined)
	end
	local CurrentHeat = hum:GetAttribute("Heat")
	local HeatRatio = CurrentHeat / MaxHeat
	resizeCustomLoadingBar(HeatRatio, HeatIconClipping, HeatIconTop)

	local function RefireCustomHeatBar()
		local NewHeat = hum:GetAttribute("Heat")
		local newHeatRatio = NewHeat/ MaxHeat
		print("refiring")
		resizeCustomLoadingBar(newHeatRatio, HeatIconClipping, HeatIconTop)
	end
	
	hum:GetAttributeChangedSignal("Heat"):Connect(RefireCustomHeatBar)
	
end
return HMH

1 Like