Permanent server network ownership

I want to set an npc’s ownership to the server but every time i playtest the game, client takes ownership after a while. I use this script:

for i,v in pairs(script.Parent:GetDescendants()) do
	if v:IsA("BasePart") then
		v:SetNetworkOwner(nil)
	end
end
script.Parent.HumanoidRootPart:SetNetworkOwner(nil)

but the client still takes ownership. I use MoveTo on the npc so its ownership not changing is important

3 Likes

You could try using RunService.Heartbeat to set it to nil every frame.

2 Likes

Yeah that is what i am using at the moment but i fell like i am wasting a lot of resources doing that. If only there was another way…

1 Like

I think there’s no other solutions other than that. Personally I wouldn’t be taking away network ownership, since character will no longer be smooth for the client. Try avoiding this method at all cost.

1 Like

Yeah ik but if i let my client take ownership the npc has trouble moving

1 Like

Is there a way to detect ownership changed? If so, every time it happens and it’s on the client, you send it back on the server

1 Like

Isn’t this a bug? I thought it worked like, once you set network owner to nil it should stay that way until you use something like :SetNetworkOwnershipAuto(). Players can manipulate their position etc. if they have ownership on the npc.

1 Like

Just checked, it works fine on me. Probably you are welding something to the npc that is not owned by the server AFTER you do that check (your given script). DO NOT use stuff like runservice.heartbeat. Doing once is enough.

3 Likes

It will not auto change back unless you set it back or something run by the client is added to it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.