How can i fix my anticheat to prevent breaking the stage selection system?

Basically my anticheat thinks the player is too far away from the stage which is false since it teleported. is there any way i can fix the issue?

Client:

local Frame = script.Parent.Frame
local Selection = Frame.Selection

-- Get the extra buttons
local UnderButtons = Frame.UnderButtons

if not Stages then
	Stages = leaderstats:WaitForChild("Stage",6)

	Stages:GetPropertyChangedSignal("Value"):Connect(function()
		LocalStages = leaderstats.Stage.Value
		Selection.Number.Text = LocalStages
	end)

else
	Stages:GetPropertyChangedSignal("Value"):Connect(function()

		local success,errorm = pcall(function()
			LocalStages = leaderstats:WaitForChild("Stage",2).Value
		end)
		
		if not success then
			print("Failed to get stage value: "..errorm)
			
			success = nil
			errorm = nil
			
			LocalStages = 0
		end
		
		if success then
			success = nil
			errorm = nil
		end

		Selection.Number.Text = LocalStages
	end)
end

function TeleportToCheckpoint(stage)
	if not stage then return end

	if stage:IsA("Model") then
		if not stage.PrimaryPart then
			warn("No primary part can't tp")
			return
		end
		
		print("teleporting to model")
		LocalPlayer.Character:MoveTo(workspace.Checkpoints[tostring(LocalStages)].PrimaryPart.Position)
	else
		print("teleporting")
		LocalPlayer.Character:MoveTo(workspace.Checkpoints[tostring(LocalStages)].Position)
	end
end

UnderButtons.SkipButton.Button.MouseButton1Click:Connect(function()
	local success,errorm = pcall(function()
		MarktplaceService:PromptProductPurchase(LocalPlayer,2838051767)
	end)
	
	if not success then
		warn("Prompt failled: "..errorm)
	end
end)

Frame.Frame.Button.MouseButton1Click:Connect(function()
   if LocalPlayer.Character then
		LocalPlayer.Character.Humanoid.Health = 0
   end
end)

-- Update the text to the value
Selection.Number.Text = LocalStages

Selection.Last.MouseButton1Click:Connect(function()
	local success,errorm = pcall(function()
		if LocalStages <= 0 then
			LocalStages = leaderstats.Stage.Value

			if workspace.Checkpoints:FindFirstChild(tostring(LocalStages)) then
				TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
				Selection.Number.Text = LocalStages
			else
				LocalStages = 0
				Selection.Number.Text = LocalStages
				TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
			end

			return
		end

		if LocalStages <= leaderstats.Stage.Value then
			LocalStages -= 1
			Selection.Number.Text = LocalStages
			TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
		end
	end)

	if not success and errorm then
		print("Failed to skip stage : "..errorm)
		LocalStages = leaderstats.Stage.Value
		Selection.Number.Text = LocalStages

		if workspace.Checkpoints:FindFirstChild(tostring(LocalStages)) then
			TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
		end
	end
end)

Selection.Next.MouseButton1Click:Connect(function()
	local success,errorm = pcall(function()
		if LocalStages >= MaxStages then
			LocalStages = 0
			Selection.Number.Text = LocalStages

			TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
			return
		end

		if LocalStages >= leaderstats.Stage.Value then
			LocalStages = 0
			Selection.Number.Text = LocalStages

			TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
			return
		end

		if LocalStages < MaxStages then
			if workspace.Checkpoints:FindFirstChild(tostring(LocalStages + 1)) then
				LocalStages += 1
				Selection.Number.Text = LocalStages

				TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
			else
				LocalStages = 0
				Selection.Number.Text = LocalStages
				TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
			end
		end
	end)

	if not success and errorm then
		print("Failed to skip stage : "..errorm)
		LocalStages = leaderstats.Stage.Value
		Selection.Number.Text = LocalStages

		if workspace.Checkpoints:FindFirstChild(tostring(LocalStages)) then
			TeleportToCheckpoint(workspace.Checkpoints[tostring(LocalStages)])
		end
	end
end)```

Server:

for _, stage in workspace.Checkpoints:GetChildren() do
	if stage:IsA("Model") then
		stage.PrimaryPart.Touched:Connect(function(hit)
			if hit and hit.Parent then
				local player = game.Players:GetPlayerFromCharacter(hit.Parent)

				if player and player:IsA("Player") then
					task.wait(0.05)
					local distance = (hit.Parent.HumanoidRootPart.Position - stage.PrimaryPart.Position).Magnitude

					if distance > 20 then
						player.Character:MoveTo(workspace.Checkpoints:FindFirstChild(tostring(player.leaderstats.Stage.Value)).PrimaryPart.Position)
						print("too far away")
						return	
					end

					local leaderstats = player:FindFirstChild("leaderstats")

					if leaderstats then
						local stageValue = leaderstats:FindFirstChild("Stage")

						if stageValue and stageValue.Value == tonumber(stage.Name) - 1 then

							-- Check if not too fast
							local currentTime = tick()

							if not UserTimes[player.UserId] then
								UserTimes[player.UserId] = {}
							end

							local logs = UserTimes[player.UserId]
							local currentTime = tick()  -- Assume `currentTime` is obtained from `tick()`

							if #logs > 0 then
								local lastLog = logs[#logs]
								local newInterval = currentTime - lastLog

								for i = 1, #logs - 1 do
									local previousInterval = logs[i + 1] - logs[i]
									if math.abs(previousInterval - newInterval) < 0.01 then  -- Small threshold for interval matching
										player:Kick("Exploiting is not allowed in our game. Please stop your actions or we might ban you from our game.")
										return
									end
								end
							end

							-- Store the current time in the log list
							table.insert(UserTimes[player.UserId], currentTime)

							-- Limit stored logs to prevent memory issues (keep last 10 logs)
							if #UserTimes[player.UserId] > 10 then
								table.remove(UserTimes[player.UserId], 1)
							end

							stageValue.Value = tonumber(stage.Name)

							if stageValue.Value == #workspace.Stages:GetChildren() then

								stageValue.Value = 0
								leaderstats.Rebirth.Value += 1
								print("rebirthed")
								player.Character:MoveTo(workspace.Checkpoints:FindFirstChild(tostring(stageValue.Value)).PrimaryPart.Position)
							end
						else
							if stageValue and stageValue.Value  then
								local difference = stageValue.Value - tonumber(stage.Name)

								if difference < -1 then
									print("trying to teleport too far away or missed checkpoint")
									player.Character:MoveTo(workspace.Checkpoints:FindFirstChild(tostring(stageValue.Value)).PrimaryPart.Position)
								end
							end 
						end	
					end
				end
			end
		end)
	end
end

I would recommend completing the teleporting from the server and updating the stage the player is at as soon as you teleport them.