Help with lua code. Ship moves forward after cod is run because ship pos is based on player look pos

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Make ship stay in the same place
  2. What is the issue? Include screenshots / videos if possible!
    It teleports forwards due to player pos
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I initially tried moving ship backwards and idk if I stil lcan but it seems to not work.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local remote = game.ReplicatedStorage.ThrowAnchor

remote.OnServerEvent:Connect(function(player,mousepos) 
	local anchor = game.ReplicatedStorage.Anchor:Clone()
	anchor.Parent = workspace
	anchor.Position = mousepos
	local ship =game.Workspace.Ships:WaitForChild(player.Name.."'s".." ship")
	local running = {}
	local deaccel = {}
	deaccel[player.Name] = {Speed = 3}
	
	
	running[player.Name] = true
	local spawnloc = ship:WaitForChild("SpawnLocation")
	local orgpos = ship:WaitForChild("OrgPos")
	spawn(function()
		wait(4)
		running[player.Name] = nil
		anchor:Destroy()
		spawnloc.CFrame = orgpos.CFrame
		--player.Character.HumanoidRootPart.Position = spawnloc.Position
		player.Character:PivotTo(spawnloc.CFrame)
		ship:PivotTo(ship:GetPivot() + player.Character.HumanoidRootPart.CFrame.LookVector * -10)
		player.Character:PivotTo(spawnloc.CFrame)
	end)
	
	spawn(function()
		while running[player.Name] == true do
			local anchorpos = ship:WaitForChild("Anchorpos")
			spawnloc.Position = anchorpos.Position
			task.wait()
			local right = ship:WaitForChild("Right")
			if right.Value == true then
				deaccel[player.Name].Speed = math.max(deaccel[player.Name].Speed - 0.05, 0)
				local rot = anchor.CFrame * CFrame.Angles(0,math.rad(-deaccel[player.Name].Speed),0)
				print(deaccel[player.Name].Speed)
				anchor.CFrame = rot
				player.Character:PivotTo(spawnloc.CFrame)
				ship:PivotTo(rot * CFrame.new(0,20,0))
				local cf = ship:GetBoundingBox()
			--ship:PivotTo(CFrame.lookAt(cf.Position, anchor.Position)) -- if you have this on it put sinking xd
			elseif right.Value == false then
				deaccel[player.Name].Speed = math.max(deaccel[player.Name].Speed - 0.05, 0)
				local rot = anchor.CFrame *  CFrame.Angles(0,math.rad(deaccel[player.Name].Speed),0)
				anchor.CFrame = rot
				print(deaccel[player.Name].Speed)
				ship:PivotTo(rot * CFrame.new(0,20,0))
				local cf = ship:GetBoundingBox()
				player.Character:PivotTo(spawnloc.CFrame)
			end
		end
	end)
end)```

Please do not ask people to write entire scripts or design entire systems for you. If you can't answer the three questions above, you should probably pick a different category.