Hey GPT, could you clean up the weights, and fix the maths in a way so it RESPECTS the thresholds? The threshold means the weight should start becoming usable at that point (So you have around 20 walk speed at 1000 MS with the first weight). And the maths is hard to read for a human at the moment, clean that up please. Next, please make the weights slow down the flight massively aswell. The user should have 50 flight speed with the given weight at the jf threshold.

local weightThresholds = {
	{weight = 0, jfThreshold = 0, msThreshold = 0},

	{weight = 1, jfThreshold = 9000, msThreshold = 1000},
	{weight = 2, jfThreshold = 210000, msThreshold = 8000},
	{weight = 3, jfThreshold = 2100000, msThreshold = 200000},
	{weight = 4, jfThreshold = 12000000, msThreshold = 2000000},
}
local function findThresholds(weight)
	for _, threshold in ipairs(weightThresholds) do
		if weight == threshold.weight then
			return threshold.jfThreshold, threshold.msThreshold
		end
	end
	return nil, nil  -- Default values if weight not found
end

function LOCAL:UpdateSpeed(player)
	local folder = player:WaitForChild("PlayerFolder")
	local DF = folder:WaitForChild("DataFolder")
	local char = player.Character
	local val = char:WaitForChild("Run")
	local SpeedSetting = folder.Settings.SetSpeed
	local JumpSetting = folder.Settings.SetJump
	if char then
		local WS = DF.MS.Value
		local JF = DF.JF.Value
		local w
		local j
		if val.Value == true then
			char:WaitForChild('Weight')
			w = math.clamp(math.clamp(1000, 0, (WS / 500) / (2 ^ char:WaitForChild('Weight').Value)), 0, 1000)
			j = math.clamp(math.clamp(500, 0, (JF / 250) / (2 ^ char:WaitForChild('Weight').Value)), 0, 500)
			if char:WaitForChild('Weight').Value > 0 then
				if w < 12 then
					w = 2
					if w > SpeedSetting.Value and SpeedSetting.Value > 0 then
						w = math.clamp(SpeedSetting.Value, 12, 1000)
					end
				end
				if j < 50 then
					j = 2
					if j > JumpSetting.Value and JumpSetting.Value > 0 then
						j = math.clamp(JumpSetting.Value, 51, 500)
					end
				end
			elseif char:WaitForChild('Weight').Value == 0 then
				w = math.clamp(w,10,1000)
				j = math.clamp(j,50,500)
				if w > SpeedSetting.Value  and SpeedSetting.Value > 0 then
					w = math.clamp(SpeedSetting.Value, 12, 1000)
				end
				if j > JumpSetting.Value  and JumpSetting.Value > 0 then
					j = math.clamp(JumpSetting.Value, 51, 500)
				end
			end
		else
			w = math.clamp(math.clamp(1000,0,(WS/1000)/(6^char:WaitForChild('Weight').Value)),0,1000)
			j = math.clamp(math.clamp(500,0,(JF/500)/6^char:WaitForChild('Weight').Value),0,500)
			if char:WaitForChild('Weight').Value > 0 then
				if w < 12 then
					w = 2
					if w > SpeedSetting.Value  and SpeedSetting.Value > 0 then
						w = math.clamp(SpeedSetting.Value, 12, 1000)
					end
				else
					w = math.clamp(w,12,16)
				end
				if j < 50 then
					j = 2
					if j > JumpSetting.Value  and JumpSetting.Value > 0 then
						j = math.clamp(JumpSetting.Value, 51, 500)
					end
				else
					j = math.clamp(j,50,51)
				end
			elseif char:WaitForChild('Weight').Value == 0 then
				w = math.clamp(w,12,16)
				j = math.clamp(j,50,51)
				if w > SpeedSetting.Value and SpeedSetting.Value > 0 then
					w = math.clamp(SpeedSetting.Value, 12, 1000)
				end
				if j > JumpSetting.Value and JumpSetting.Value > 0 then
					j = math.clamp(JumpSetting.Value, 51, 500)
				end
			end
		end
		return w,j
	end
end


function LOCAL:GetFlightSpeed(JF, player, overrideSpeed)
	if player.Character:FindFirstChild("BT") then
		return 0
	end
	local weight = player.Character:WaitForChild('Weight').Value
	local default = 16
	if weight > 0 then
		default =	LOCAL:GetMaxFlight(JF)
	end
	if overrideSpeed then
		ctrl = not ctrl
	end
	local defaultSpeed = LOCAL:GetMaxFlight(JF)
	local playerSettingsSpeed = player.PlayerFolder and player.PlayerFolder.Settings and player.PlayerFolder.Settings.SetSpeed.Value
	if playerSettingsSpeed == 0 then return defaultSpeed end

	if playerSettingsSpeed and playerSettingsSpeed <= defaultSpeed then
		return playerSettingsSpeed
	end
	if defaultSpeed <50 then
		defaultSpeed = 50
	end
	return defaultSpeed
end