--> 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

