I am making a game where a character moves to a randomized (between two parts) part. The character doesn't move and sits there, can someone help me? Here is my code

local Jh = script.Parent.Jace.JacePlayZ.Humanoid
local Jhrp = script.Parent.Jace.JacePlayZ:WaitForChild("HumanoidRootPart")
local Jlt = script.Parent.Jace.JacePlayZ.UpperTorso
local Jm = math.random(1,2)
local move1 = script.Parent.EnemyTelePoints.JaceTelePoints.JaceTeleL
local move2 = script.Parent.EnemyTelePoints.JaceTelePoints.JaceTeleR
local pathfindingS = game:GetService("PathfindingService")

wait(5)

if Jm == 1 then
	local path1 = pathfindingS:CreatePath()
	path1:ComputeAsync(Jlt.Position, move1.Position)
	Jh:MoveTo(move1.Position)
elseif Jm == 2 then
	local path2 = pathfindingS:CreatePath()
	path2:ComputeAsync(Jlt.Position, move2.Position)
	Jh:MoveTo(move2.Position)
end

1 comment

0

Server script or local script