My Pathfinding script:
local PathFindingService = game:GetService("PathfindingService")
wait(4)
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Root = script.Parent:WaitForChild("HumanoidRootPart")
local HumanRoot = workspace:FindFirstChild("billyandme"):WaitForChild("HumanoidRootPart")
local Pathparam = {
AgentRadius = 0.5,
AgentHeight = 3,
AgentCanJump = true
}
local hcf
Root:SetNetworkOwner(nil)
local function walk(hcf)
local path = PathFindingService:CreatePath()
local look = hcf.LookVector
path:ComputeAsync(Root.Position,Vector3.new(hcf.x + (look.x*(-5)),hcf.y,hcf.z + (look.z*(-5))))
local waypoints = path:GetWaypoints()
wait()
for _,v in pairs(waypoints) do
--[[
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Position = v.Position
part.Size = Vector3.new(0.6,0.6,0.6)
part.Anchored = true
part.CanCollide = false
part.Parent = workspace
----]]
if v.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
Humanoid:MoveTo(v.Position)
repeat wait() until (Root.Position.x - v.Position.x) <= 1 and (Root.Position.z - v.Position.z) <= 1
end
print("Finished Walking")
end
while wait() do
hcf = HumanRoot.CFrame
if (math.abs(math.sqrt(((hcf.x-Root.CFrame.X) * (hcf.x-Root.CFrame.X)) + ((hcf.z-Root.CFrame.z) * (hcf.z-Root.CFrame.z)))) > 10) and (math.abs(math.sqrt(((hcf.x-Root.CFrame.X) * (hcf.x-Root.CFrame.X)) + ((hcf.z-Root.CFrame.z) * (hcf.z-Root.CFrame.z)))) < 100) then
walk(hcf)
end
end
creates a very rigid movement of the duck that is supposed to follow me shown below:
https://gyazo.com/0dd472beea024693334fd56d691dc184
Does anybody have an idea on how to make this movement more smooth and natural