For some reason my moveto script is very choppy near the player (when I press run in studio it works fine). Its network ownership is set to nil from this script:
local NPC = script.Parent
for _, v in pairs(NPC:GetChildren()) do
if v:IsA("BasePartPart") then
v:SetNetworkOwner(nil)
end
end
Here is the movement script:
function moveto(part)
if part == "oven" then
print("walking")
hum:MoveTo(ovenwalk.Position)
hum.MoveToFinished:Wait()
elseif part == "fridge" then
print("walking")
hum:MoveTo(fridgewalk.Position)
hum.MoveToFinished:Wait()
elseif part == "salt" then
print("walking")
hum:MoveTo(saltwalk.Position)
hum.MoveToFinished:Wait()
elseif part == "plr" then
print("walking")
hum:MoveTo(plrwalk.Position)
hum.MoveToFinished:Wait()
elseif part == "backroom" then
print("walking")
hum:MoveTo(backroom.Position)
hum.MoveToFinished:Wait()
end
end
I don’t really understand why this would be happening. Can somebody please explain?