local function y()heatBar.Visible=heldGunHeat.Value>.025 heatBar.Heat.Size=UDim2.new(heldGunHeat.Value,0,1,0)end local function Z(Z)for y,s in ipairs(images:GetChildren())do if s.Name==Z.Name then s.ImageTransparency=0 else s.ImageTransparency=1 end end heldGunHeat=Z:WaitForChild("\072\101\097\116")if heatConnection then heatConnection:Disconnect()end y()heatConnection=heldGunHeat.Changed:Connect(function(Z)y()end)end local function s(y)for Z,s in ipairs(images:GetChildren())do if s.Name==y.Name then s.ImageTransparency=0 else s.ImageTransparency=1 end end heatBar.Visible=false if heatConnection then heatConnection:Disconnect()end end
--> Main

local function UpdateHeatBar()
	heatBar.Visible = heldGunHeat.Value > 0.025

	heatBar.Heat.Size = UDim2.new(heldGunHeat.Value, 0, 1, 0)
end

local function SetupGUIForHeldGun(gun)
	for i, image in ipairs(images:GetChildren()) do
		if image.Name == gun.Name then
			image.ImageTransparency = 0
		else
			image.ImageTransparency = 1
		end
	end

	heldGunHeat = gun:WaitForChild("Heat")

	if heatConnection then
		heatConnection:Disconnect()
	end
	UpdateHeatBar()
	heatConnection = heldGunHeat.Changed:Connect(function(property)
		UpdateHeatBar()
	end)
end

local function SetupGUIForHeldMelee(melee)
	for i, image in ipairs(images:GetChildren()) do
		if image.Name == melee.Name then
			image.ImageTransparency = 0
		else
			image.ImageTransparency = 1
		end
	end

	heatBar.Visible = false
	if heatConnection then
		heatConnection:Disconnect()
	end
end
