Hi!
I have making story game but i have problem with npc
when npc sit on the seat then when they get off, when they walk, they just walk do not smoothly
This is before npc will sit on the seat
robloxapp-20200719-1911472.wmv (1013.2 KB)
Sorry for bad quality video
This is after npc sit on the seat
robloxapp-20200719-1913486.wmv (3.8 MB)
This is my walking script
game.ReplicatedStorage.Events.MoveNPCWithPathFindingEvent.Event:Connect(function(object,point)
local pathfindingService = game:GetService("PathfindingService")
-- Variables for NPC humanoid, torso, and destination
local humanoid = object.Humanoid
local body = object:FindFirstChild("HumanoidRootPart") or object:FindFirstChild("Torso")
local destination = point.Position
-- create path object
local path = pathfindingService:CreatePath()
-- compute a path
path:ComputeAsync(body.Position, destination)
-- get the waypoints table
local waypoints = path:GetWaypoints()
-- iterate through all waypoints, and jump when necessary
for k, waypoint in pairs(waypoints) do
humanoid:MoveTo(waypoint.Position)
-- change humanoid state to jump if necessary
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
humanoid.MoveToFinished:Wait()
end
end)
Thank you and sorry for bad english