Agent always jumping, when walks (SimplePath)

Every time I create a new path and the block follows it, it jumps every time. Has anyone else encountered this and knows the solution?

-- Compiled with roblox-ts v3.0.0
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local Reflect = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@flamework", "core", "out").Reflect
local Component = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@flamework", "components", "out").Component
local _services = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "services")
local Players = _services.Players
local RunService = _services.RunService
local Action = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "shared-components-flamework", "out").Action
local SimplePath = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "simple-path", "out").default
local Trove = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "trove", "out").Trove
local PetComponent = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "components", "pet").PetComponent
local pet_tag = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "utilities", "tags").pet_tag
local ServerPetComponent
do
	local super = PetComponent
	ServerPetComponent = setmetatable({}, {
		__tostring = function()
			return "ServerPetComponent"
		end,
		__index = super,
	})
	ServerPetComponent.__index = ServerPetComponent
	function ServerPetComponent.new(...)
		local self = setmetatable({}, ServerPetComponent)
		return self:constructor(...) or self
	end
	function ServerPetComponent:constructor()
		super.constructor(self)
		self.trove = Trove.new()
		self.path = SimplePath.new(self.instance)
		self.relativeCFrame = CFrame.new(0, 0.5, 3)
		self.speed = 0.15
		if self.attributes.OwnerId == nil then
			return nil
		end
		self:setup()
		if not self.state.owner then
			return nil
		end
		self.character = self.state.owner.Character or (self.state.owner.CharacterAdded:Wait())
		self.path.Blocked:Connect(function()
			warn("Path blocked")
		end)
		self.path.Error:Connect(function(err)
			warn(`Path error: {err}`)
		end)
		task.wait(3)
		self:startFollow()
	end
	function ServerPetComponent:onStart()
		print("started on server", self.instance)
	end
	function ServerPetComponent:startFollow()
		self.trove:connect(RunService.Heartbeat, function(deltaTime)
			local _result = self.character
			if _result ~= nil then
				_result = _result:FindFirstChild("HumanoidRootPart")
			end
			local rootPart = _result
			print(rootPart)
			if not rootPart then
				return nil
			end
			local _cFrame = rootPart.CFrame
			local _relativeCFrame = self.relativeCFrame
			local target = _cFrame * _relativeCFrame
			print(target)
			self.path:Run(target.Position)
		end)
	end
	function ServerPetComponent:setup()
		local ownerId = self.attributes.OwnerId
		local player = Players:GetPlayerByUserId(ownerId)
		local _object = table.clone(self.state)
		setmetatable(_object, nil)
		_object.owner = player
		return _object
	end
	function ServerPetComponent:destroy()
		self.trove:destroy()
		self.path:Destroy()
	end
	do
		-- (Flamework) ServerPetComponent metadata
		Reflect.defineMetadata(ServerPetComponent, "identifier", "server/components/pet@ServerPetComponent")
		Reflect.defineMetadata(ServerPetComponent, "flamework:implements", { "$:flamework@OnStart" })
	end
	local _descriptor = Action()(ServerPetComponent, "setup", {
		value = ServerPetComponent.setup,
	})
	if _descriptor then
		ServerPetComponent.setup = _descriptor.value
	end
end
-- (Flamework) ServerPetComponent decorators
Reflect.decorate(ServerPetComponent, "$c:components@Component", Component, { {
	tag = pet_tag,
	attributes = {},
} })
return {
	ServerPetComponent = ServerPetComponent,
}

Not sure what’s causing it, but this would be a cool way to make enemies or pets tbh

I never used simple path but it obviously triggers the jumping state while he makes the path so i would look into the function of the module that creates the path.

You probably looked into it already tho.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.