"Network Ownership API can only be called from the Server" error in LocalScript

Hello! I am making client sided models and I am using SetNetworkOwner() . I have a remote event to do this. In a local script I receive the event, but I get this error.

16:00:16.363 - Network Ownership API can only be called from the Server.

This is my script.

local remotevar = game.ReplicatedStorage.LocalModelOrPart
local player = game.Players.LocalPlayer

remotevar.OnClientEvent:Connect(function()
	
	local push = game.ReplicatedStorage:WaitForChild("PushPlatforms")
	local pushclone = push:Clone()
	print("Cloned model folder")
	
	local models = pushclone:GetChildren()
	
	for _, model in pairs(models) do
		
		local baseparts = model:GetChildren()
		
		for _, basepart in pairs(baseparts) do
			if basepart:IsA("BasePart") then
				print("Is base part")
				basepart.Parent = workspace
				basepart:SetNetworkOwner(player)
				print("Set network owner to "..player.Name)
				basepart.Parent = workspace:WaitForChild("Tower of Troubling Tutorials")
			end
		end
	end
	
	pushclone.Parent = workspace:WaitForChild("Tower of Troubling Tutorials")
	print("Success! Placed folder inside the Tower of Troubling Tutorials inside the workspace!")
	
end)

What would I have to do? Do I have to fire another remote event?

1 Like

You are attempting to set a network owner on the client. Try it with client to server instead of server to client.

2 Likes

Network ownership’s SetNetworkOwner function can only be called from a server sided script. But I don’t understand one thing though, you are cloning the model in client side anyways so, why do that?

1 Like

Well I made a separate topic on this. Here it is: Why can players still use the same model?

I am trying to make it so that each player has their own model that they can use, but it never seems to work.

Okay, people on that thread have most likely solved your issue using SetNetworkOwner. So if really have to do then what I would have done is, cloned that model on server side, set network owner and then fire a event to all clients with the model and player who created.

Then in the remote events on client event function, I would check if they are the same player who created this model. If not then delete it.

This is what I could have thought in this short matter of time though it’s probably not the best.

1 Like

Ok after doing a bit of testing, I get the error that parts need to be unanchored in order for SetNetworkOwner to work. Are there any alternatives I can use to achieve my problem for anchored parts, welds, and constraints?

Oh, I want to know one thing is that some details about your model. Like for suppose, what its supposed to do, because what I can see is its moving a player from one side to the other.

Also try removing the SetNetworkOwner part once and test with 2 players again, and see if its the same behaviour. Otherwise SetNetworkOwner is what you have to try next.

1 Like

I will have to wait to test with two players again as I require my friend, but I can tell you details about my model. It will actually be best if I send it to you.

Model: Push Platform for the devforum - Roblox

Actually in the studio you can go to Test tab, and then start a local server with 2 players. It will allow you do to a simulation of 2 different players.

But anyways I will check the model

Oh yea I do know about that, but recently, my computer or roblox studio itself hasn’t been allowing me to do it. That is why I need to ask my friend to test with me when I want to test with two players.

1 Like

You can also install the roblox app (assuming you are on windows) and run that at the same time as either the studio or a roblox game in the browser. You will need two accounts tho.

1 Like

I’ve modified your post title to contain the error itself - this helps others in the future find this same problem (and hopefully a solution) more easily. Try to refrain from asking broad questions in the title.

1 Like