--------------------[ GUI UPDATE FUNCTIONS ]------------------------------------------


local function updateClipAmmo()
	clipAmmoGUI.Text = Ammo.Value
	clipAmmoGUI.TextColor3 = (Ammo.Value <= (ClipSize.Value / 3) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
end

local function updateStoredAmmo()
	storedAmmoGUI.Text = StoredAmmo.Value
	storedAmmoGUI.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 2) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
end

local function updateHealth()
	HUD.Health.Num.Text = CEIL(Humanoid.Health).."%"
	HUD.Health.Num.TextColor3 = (
		(Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or
		(Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or
		(Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0)
	)
end

local function updateModeLabels(prevState, newState, X)
	for Num, Mode in pairs(fireModes:GetChildren()) do
		local guiAngOffset2 = guiAngOffset + 90
		local Ang = numLerp(
			(guiAngOffset2 * prevState) - (guiAngOffset2 * Num) - guiAngOffset2,
			(guiAngOffset2 * newState) - (guiAngOffset2 * Num) - guiAngOffset2,
			Sine(X)
		) + guiAngOffset
		local XPos = COS(RAD(Ang))
		local YPos = SIN(RAD(Ang))
		Mode.Position = UDim2.new(0.5, XPos * 100, 0.5, YPos * 100)
		
		local R = COS(math.atan2(Mode.Position.Y.Offset, Mode.Position.X.Offset) + RAD(90))
		Mode.Label.TextTransparency = 1 - ((R / 4) + 0.75)
		
		local Scale = (R * 10) + 50
		Mode.Label.Position = UDim2.new(0, -Scale / 2, 0, 0)
		Mode.Label.Size = UDim2.new(0, Scale, 0, Scale / 2)
	end
end
