basically my pathfinding service is acting really weird..... Basically I have this loop where i was gonna do every 2 minutes he goes into the breakroom and then comes back out in 2 minutes but after it does it one time the next time its all stuttering and janky when he walks
I also have a video of what its doing here https://www.youtube.com/watch?v=bpX6skqQrbY&ab_channel=DatBigBoi video got cut off a little btw
Here's my code
while true do
wait(5)
local PathfindingService = game:GetService("PathfindingService")
local Humanoid = script.Parent.Humanoid
local Root = script.Parent:FindFirstChild("HumanoidRootPart")
local goal = game.Workspace.EndingPart.Position
local breakroom = game.Workspace.BreakRoom.Model
local breakroom = game.Workspace.BreakRoom.Model.Door
local breakroom2 = game.Workspace.BreakRoom.Model.Handle
local tod = game.Workspace.Tod
local sound = script.Parent.sound
local sound2 = game.Workspace.sound2E
local todClone = game.ReplicatedStorage
local sound3 = game.Workspace.sound3
local todWorkspace = game.Workspace.Tod
local path = PathfindingService:CreatePath()
path:ComputeAsync(Root.Position, goal)
local waypoints = path:GetWaypoints()
for i, waypoint in ipairs(waypoints) do
Humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
Humanoid.MoveToFinished:Wait()
end
breakroom.CFrame = CFrame.new(709.197, 4.065, 655.979) * CFrame.Angles(0, -26.3, 0)
breakroom2.CFrame =CFrame.new(710.407, 4.199, 657.698) * CFrame.Angles(0, 156.24, 0)
sound:Play()
wait(1)
tod:MoveTo(Vector3.new(712.44, 0.9, 707.521))
wait(1)
sound2:Play()
breakroom.Position = Vector3.new(707.419, 4.065, 651.726)
breakroom.Orientation = Vector3.new(0, 89.31, 0)
breakroom2.Position = Vector3.new(708.148, 4.199, 650.094)
breakroom2.Orientation = Vector3.new(0, 91.69, 0)
wait(5)
breakroom.CFrame = CFrame.new(709.197, 4.065, 655.979) * CFrame.Angles(0, -26.3, 0)
breakroom2.CFrame =CFrame.new(710.407, 4.199, 657.698) * CFrame.Angles(0, 156.24, 0)
sound:Play()
wait(1)
tod:MoveTo(Vector3.new(712.684, 1.007, 651.908))
wait(2)
sound2:Play()
breakroom.Position = Vector3.new(707.419, 4.065, 651.726)
breakroom.Orientation = Vector3.new(0, 89.31, 0)
breakroom2.Position = Vector3.new(708.148, 4.199, 650.094)
breakroom2.Orientation = Vector3.new(0, 91.69, 0)
wait(1)
local TPback = workspace.BackToRegister.Position
local path = PathfindingService:CreatePath()
path:ComputeAsync(Root.Position, TPback)
local waypoints = path:GetWaypoints()
for i, waypoint in ipairs(waypoints) do
Humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
Humanoid.MoveToFinished:Wait()
end
todWorkspace:SetPrimaryPartCFrame(CFrame.new(714.46, 3.507, 627.013) * CFrame.Angles(0, math.rad(-90), 0)
)
end
