r/code • u/WarriorsTrash • May 11 '20
Halp pls! I need help with roblox code
i've tried many scripts and plugins and i still can't use pathfinding service. i tried this:
local PathfindingService = game:GetService("PathfindingService")
-- Variables for the zombie, its humanoid, and destination
local chicken = game.Workspace.Chicken
local humanoid = zombie.Humanoid
local destination = game.Workspace.Nest
-- Create the path object
local path = PathfindingService:CreatePath()
-- Compute the path
path:ComputeAsync(zombie.HumanoidRootPart.Position, destination.PrimaryPart.Position)
-- Get the path waypoints
local waypoints = path:GetWaypoints()
-- Loop through waypoints
for _, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Shape = "Ball"
part.Material = "Neon"
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Position = waypoint.Position
part.Anchored = **true**part.CanCollide = **false**part.Parent = **game**.Workspaceend
What's wrong? Did i forget something?
1
u/Binau-01 May 11 '20
Can you provide some more context?