SetNetworkOwner not working

The problem I’m experiencing is “SetNetworkOwner()” and how its only working once, I don’t know if I messed up the code somewhere but any help is appreciated

Code:

script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player,X,Y,Z)
	if active == 1 then
		active = 0
		print("activated")
		local h = game.ServerStorage.SuddenChanges.Bulleter:Clone()
		local j = h.Aimer
		h.Parent = game.Workspace
		h.PrimaryPart = h.Hum
		h:SetPrimaryPartCFrame(script.Parent.Parent["Torso"].CFrame * CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0))
		script.Parent.Owner.Value = Player.Name
		h.Aimer.Owner.Value = script.Parent.Owner.Value
		j:SetNetworkOwner(Player)
        wait(5)
		active = 1
	end
end)	


script.Parent.Deactivated:Connect(function()
	print("Deactivated")
end)```

Also, “j” is supposed to be the part that the bullets come out of.

Can you elaborate more. I Understood that you are having problems with SetNetworkOwner(). Also i understand that you are trying to do that so it doesn’t replicate and causes lag tho you should set it to nil. Why? It will set it to the server so there are no jitters in your bullet.

I heard that setting it to nil its bad cause lets say the game is packed; there will be a lot of fires shot and all that at the same time would cause lag/delay. Also, I can elaborate, when I did “h.Aimer:SetNetworkOwner(Player)” it only works once and then the tool becomes unusable.

Oh I thought jitter was your problem my bad.

‘h’ is your Gun Right? Also is active some kind of debounce?

Yes, technically, the bullet spawns on h so I parented the bullet to Aimer (The main part of h) so when I set the networkowner it would also smooth the bullets velocity.

does it print deactivated in the end?

The tool or the bullet? (keystrokes)

No the function in the end.does it print?

No, but that doesn’t matter, I forgot to delete that so its just kind of here.

I feel you are trying to fire it in this period as i believe your ‘active’ is a debounce which isn’t allowing the script to fire when it’s ‘0’.
Try reducing the wait to <1 (i may be wrong)

That “wait(5)” is the cooldown, five seconds before the tool can be used again.

That’s what I am saying you are trying to fire it in that ‘wait(5)’ period. Try reducing the wait.

Set it to 0, still not working

Does it give any error by chance?

“Network Ownership API cannot be called on Anchored parts or parts welded to Anchored parts”

You should set the networkowner to the bullet since is the part that is moving.

Also you cant call it on anchored and welded parts, the error itself says so

I can’t because theres a script that makes the bullet spawn, so I can’t make the networkowner to the bullet itself cause I can’t get to it.