Obby Stage Selector is Buggy

I have finally got the obby stage selector to work for me but there is a slight problem. When the player types in a random number in the input button and they press the right or left arrow, it glitches and lets them go to that portion of the obby even if they haven’t gotten there. It doesn’t allow them to progress because it doesn’t save when they go over the checkpoints but I would like to figure out how to fix this so people can’t just skip through the stages. Here are the scripts inside each of the ui buttons:

Input:

local Rep = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

script.Parent.Text = tostring(game:GetService("Players").LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Stage").Value) -- updates stage number on death

script.Parent.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		Rep:WaitForChild("StageSelector"):FireServer(script.Parent.Text)
	end
end)

Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Stage").Changed:Connect(function(val)
	script.Parent.Text = tostring(val) -- updates stage number on advancing
end)

Right:

local player = game:GetService("Players").LocalPlayer
repeat wait() until player.Character
local character = player.Character
local Right = script.Parent
local text = script.Parent.Parent.Input
local checkpoints = game.Workspace.Checkpoints

Right.MouseButton1Click:Connect(function()

	local stage = game.Players.LocalPlayer.leaderstats.Stage
	if tonumber(text.Text) == stage.Value then

		text.Text = -1

	end

	text.Text = tostring(tonumber(text.Text) + 1)

	character:PivotTo(checkpoints[text.Text].CFrame + Vector3.new(0, 5, 0))

end)

Left:

local player = game:GetService("Players").LocalPlayer
repeat wait() until player.Character
local character = player.Character
local Left = script.Parent
local text = script.Parent.Parent.Input
local checkpoints = game.Workspace.Checkpoints

Left.MouseButton1Click:Connect(function()
	local stage = game.Players.LocalPlayer.leaderstats.Stage

	if tonumber(text.Text) == 0 then
		text.Text = stage.Value + 1
	end
	text.Text = tostring(tonumber(text.Text) - 1)
	character:PivotTo(checkpoints[text.Text].CFrame + Vector3.new(0, 5, 0))
end)

Screenshot 2023-03-07 185046

I’m not sure what else to do at this point because it took me a while to be able to get the stage selector to work in the first place so any help is very much appreciated.