I’ve been having this one little issue with my NPCs, the longer the game is up, the more the NPCs stutter in their movement. I’ve gone through ~20 posts here on the DevForum, and they all said the same.
“Set the primary part network ownership to the server.”
This is precisely what I’ve tried, and it doesn’t work. Here’s my code which does it.
for _, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(part, "npcs")
part:SetNetworkOwner(nil)
end
end
The same thing still happens, I’ve tried countless stuff, but nothing has changed.
Any ideas?
I really hope someone with a good understanding of Lua. Can help HedTB, I’ve known him for a while and he’s a really ambitious roblox developer pushing his limits!
Any replies or help is much appreciated.
After doing a little bit of digging I found this. Try giving this a shot and if it prints and error if you could tell me what It is we can probably figure it out.
local success, errorReason = Character:CanSetNetworkOwnership()
if success then
Character:SetNetworkOwner(networkOwner)
else
-- Sometimes this can fail, so throw an error to prevent
-- ... mixed networkownership in the 'model'
error(errorReason)
end
I only ask because i had issues with my NPCs and i read that if your script welds something to the NPC to also set network ownership both before and after the weld.
Oh wait, I’m actually welding it after setting the network ownership…
Let me change that and see if it changes anything, if so, I’ll set your post as the solution.
Update: Wow, that little hitbox caused that much damage… Thanks so much for the help!