Hello, I currently have a movement system for a Unit/Infantry that uses MoveTo() to move it to the position of a province when the player right clicks.
Right now the Unit just moves directly to the clicked province even if that province is 5 provinces away, I need help trying to make a system where the
unit moves to the provinces on the path to the selected one instead of heading straight to it. (Image attatched of what I mean)
So far I have tried using a system where it loops through the provinces and sees which are closest to the chosen one but it wouldn’t work exactly right.
The Server script (shortened so its only the main part shown)
local RS = game:GetService("ReplicatedStorage")
local ChooseNation = RS:WaitForChild("ChooseNation")
local MT = game.Workspace:WaitForChild("MapTesting")
MV.OnServerEvent:Connect(function(player,EndPosition,Unit,nation,provinc,playersnationfolder)
local UnitHum = Unit:WaitForChild("Humanoid")
local StartPos = Unit.HumanoidRootPart.Position
UnitHum:MoveTo(EndPosition)
Unit.Values.IsMoving.Value = true
task.wait()
Unit.Values.IsMoving.Value = false
Unit.Values.SiegingEnemy.Value = false
end