-
I want to click and get the mouse position, then on the mouse position a small part spawns in which another part called army moves to. The part is in a model called HumanoidRootPart and in the model as well is a Humanoid. The parts are also unanchored.
-
What is the issue? The part called army is not moving whatsoever and stays still. The code completely runs through as normal but MoveToFinished doesnt reigster.
-- VARIABLES --
local player = game.Players.LocalPlayer
local marker = game.ReplicatedStorage:WaitForChild("GoTo")
local mouse = player:GetMouse()
local Army = game.Workspace.Army -- Make sure the character is in the Workspace
-- MAIN --
local function Pathfinding()
local MarkerClone = marker:Clone()
MarkerClone.Parent = game.Workspace
print("Marker Cloned")
MarkerClone.Position = mouse.Hit.Position
print("Coordinates : ", MarkerClone.Position)
Army:FindFirstChild("Humanoid"):MoveTo(MarkerClone.Position)
print("Army Relocating...")
Army.Humanoid.MoveToFinished:Connect(function()
print("Army Relocated")
MarkerClone:Destroy()
end)
end
mouse.Button1Down:Connect(Pathfinding)