How can I do this? trying to detect everytime a player gets farther from the orgin point

hey so im trying to detect everytime the local player gets farther from the orgin point(0, 0, 0) this is my code right now.

	local playerName = player.Name
local char = game.Workspace:WaitForChild(playerName)
local humanoidRootPart = char:WaitForChild("HumanoidRootPart")

local magnitude = (humanoidRootPart.Position - game.Workspace.MainPart.Position).magnitude

spawn(function()
	
end)

I wanna detect if the player magnitude changes by increments of 10 then ill do something how can i achieve this?

Track the humanoid’s speed through an event:

After you know that the player is moving, keep recalculating the magnitude.