You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? An NPC moving only for the client side
-
What is the issue? The NPC only moves when the player is close to it.
-
What solutions have you tried so far? Setting the network ownership, Searching Dev Forums
Its kind of confusing, I saw a post saying to Set the network ownership however all that did was make it so my NPC didn’t move at all.
At first I was thinking to just make it part of the game but the distance it needs to be from the player is really inconsistent and it seems to be REALLY stubborn.
The script is a local script if that helps.
local debounce = false
local touchPart = workspace.TriggerDialogue.Misc.Touch1
local path = PathfindingService:CreatePath({
AgentRadius = 3,
AgentHeight = 6,
AgentCanJump = true
})
path:ComputeAsync(NPC.HumanoidRootPart.Position, workspace.Spawn.Trees2.StopPoint.Position)
touchPart.Touched:Connect(function(hit)
if not hit.Parent:FindFirstChild("NPC") and debounce == false then
print("Check1")
if hit.Parent:FindFirstChild("Humanoid") then
local Waypoints = path:GetWaypoints()
print("Successfully got waypoints")
for i, waypoint in pairs(path:GetWaypoints()) do
NPC.Humanoid:MoveTo(waypoint.Position)
print("Moving to Waypoint ".. i)
local part = Instance.new("Part")
part.Anchored = true
part.Position = waypoint.Position + Vector3.new(0, 2, 0)
part.Size = Vector3.new(0.6, 0.6, 0.6)
part.Shape = Enum.PartType.Ball
part.Parent = workspace
part.CanCollide = false
NPC.Humanoid.MoveToFinished:Wait()
end
debounce = false
end
end
end)