The network ownership of each part is set to nil and the script is as basic as any of the documentation examples.
its supposed to walk staight , but it does these stops
The network ownership of each part is set to nil and the script is as basic as any of the documentation examples.
not to be offensive but i think the npc is a member of the LGBT
May we have the code? We can not resolve your problem without you giving us proper information about it A.K.A The script in the NPC. So we can analyze it and resolve your issue
Also by the video it seems like either the wait between each step is too long causing that to happen or network ownership isnt set accurately.
Basically the code for the npc’s movement, keep in Mind some variables may be missing in this example, but in the real code they are there .Let me know if something is off
--function for NetworkOwnership
local function setNetworkOwnerOfModel(model, networkOwner)
for _, descendant in pairs(model:GetDescendants()) do
if descendant:IsA("BasePart") then
local success, errorReason = descendant:CanSetNetworkOwnership()
if success then
descendant:SetNetworkOwner(networkOwner)
else
error(errorReason)
end
end
end
end
--path
local path = PathfindingService:CreatePath{
AgentRadius = 3,
AgentCanJump = false,
Costs = {
Teleport = 0.1, --in this example doesn't matter really
}
}
local waypoints= nil
local nextWaypointIndex = nil
local reachedConnection = nil
local blockedConnection = nil
followpath(destination)
local success, errorMessage = pcall(function()
path:ComputeAsync(torso.Position, destination)
end)
if success and path.Status == Enum.PathStatus.Success then
-- Get the path waypoints
waypoints = path:GetWaypoints()
-- Detect if path becomes blocked
blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
-- Check if the obstacle is further down the path
if blockedWaypointIndex >= nextWaypointIndex then
-- Stop detecting path blockage until path is re-computed
blockedConnection:Disconnect()
-- Call function to re-compute new path
followPath(destination)
end
end)
-- Detect when movement to next waypoint is complete
if not reachedConnection then
reachedConnection = human.MoveToFinished:Connect(function(reached)
if reached and nextWaypointIndex < #waypoints then
-- Increase waypoint index and move to next waypoint
nextWaypointIndex += 1
print(waypoints[nextWaypointIndex].Label)
end
human:MoveTo(waypoints[nextWaypointIndex].Position)
else
reachedConnection:Disconnect()
blockedConnection:Disconnect()
ReachedGoal()
end
end)
end
I once got it working with changing the ‘torso’ of the character’s networkofnership to ‘nil’
, but I can’t think of anything else since I looked at how basic pathfinding is done in the documentation so I just quickly wrote up a similar code, so unless I meesed up somewhere, It would have to be because of the character or its environment