Why can players still use the same model?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Models stored inside a model to be client sided so players can use their own model.
  2. What is the issue? Include screenshots / videos if possible!
    Everything seems to work but players can still use the same models.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I made a topic on this problem, a few actually, but the solutions I got didn’t work and I didn’t understand them.

Local script inside starter player scripts:

local push = game.ReplicatedStorage:WaitForChild("PushPlatforms")
local pushclone = push:Clone()
print("Cloned model folder")

pushclone.Parent = workspace:WaitForChild("Tower of Troubling Tutorials")
print("Success! Placed folder inside the Tower of Troubling Tutorials inside the workspace!")

By using models, I mean the pushing platforms. These platforms are pushable so that players can push them. They have constraints and other things in them but no scripts. I stored them inside a model inside a folder inside replicated storage, so that I can clone them and put them inside the workspace where I want them to be. Everything in this current script prints, and I can see the models perfectly, but the issue is that multiple players can use the same model.

2 Likes

How can this be if your movable model only exists on the client? If it only is on individual clients, and not the server, it shouldn’t be able to replicate in this instance since it’s not even available to anyone else, as far as I know.

True, that is why I am very confused. I have no idea why this is not working.

1 Like

Just noticed it is in starter player scripts nevermind.

1 Like

Can we get a video of you double client( with two clients and two windows )testing this, so we can see it for ourselves? Being able to see it happen would be helpful in figuring out the issue.

Also, if the models spawn in at different times, are you saying that all of the models teleport to the Position of the first one? I can’t quite picture this.

1 Like

Here is a visual.

https://gyazo.com/c404687adf309f1c847e002df2a9f76d

So as you can see my friend gets pushed off as I use it.

Edit: He also gets on the platform, but as you can see, he doesn’t really push it, and the platform is moving for him when I am pushing it.

1 Like

Hmm, maybe it’s a network ownership kind of thing? Might be because of the physics based movement you are using. I believe roblox tries to automatically replicate physics on a basepart to a server especially with constraints.

Also see here, definitely the constraints, physics on client is automatically updated for server.

While part properties do not technically replicate, there are a few exceptions. If the part is created by a client and that client simulates physics (the part falls, hits other objects, moves by constraints, etc.), the resulting changes will get copied to the server.

3 Likes

Hmmm, to fix it I suggest changing the root part of the moving platform model:

It says if each client has a different root part that the client replication will the seperate

How can I achieve this? I created a remote event to make the models local but it still doesn’t. I made a server script inside the server script service saying this:

local remotevar = game.ReplicatedStorage.LocalModelOrPart

game.Players.PlayerAdded:Connect(function(player)
	
	remotevar:FireClient(player)
	
end)

And then in a local script inside the starter player scripts I did this:

local remotevar = game.ReplicatedStorage.LocalModelOrPart

remotevar.OnClientEvent:Connect(function()
	
	local push = game.ReplicatedStorage:WaitForChild("PushPlatforms")
	local pushclone = push:Clone()
	print("Cloned model folder")
	
	pushclone.Parent = workspace:WaitForChild("Tower of Troubling Tutorials")
	print("Success! Placed folder inside the Tower of Troubling Tutorials inside the workspace!")
	
end)

It seems to clone and parent fine, but it still has the same issue. You recommend me into changing the root part of the moving platform model? And if I do, would I keep the same code?

1 Like

Hmm, NVM, dont use the root priority method, it will be a lot complex and unnecessary:

Yeah you can use the same code you just need to continue changing the model properties so that it is fully client sided.

Try just using :SetNetworkOwner() on each model clone basepart so use a for loop to iterate through each basepart in the model.

1 Like

Like this?

local remotevar = game.ReplicatedStorage.LocalModelOrPart

remotevar.OnClientEvent:Connect(function()
	
	local push = game.ReplicatedStorage:WaitForChild("PushPlatforms")
	local pushclone = push:Clone()
	print("Cloned model folder")
	
	for i, v in pairs(push:GetChildren()) do
		if v:IsA("BasePart") then
			v:SetNetworkOwner()
		end
	end
	
	pushclone.Parent = workspace:WaitForChild("Tower of Troubling Tutorials")
	print("Success! Placed folder inside the Tower of Troubling Tutorials inside the workspace!")
	
end)

Edit: It doesn’t work,

1 Like

Oh you have to set the network owner to the player, currently you are setting it to nill which is the server

Plus you should set network owner ship on the cloned model since those models are meant for the player only

physics replication is what you’re looking at, roblox does this to parts which are on client-side slopes as well

New script does an error. Why?

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")
	
	pushclone:SetNetworkOwner(player)
	
	pushclone.Parent = workspace:WaitForChild("Tower of Troubling Tutorials")
	print("Success! Placed folder inside the Tower of Troubling Tutorials inside the workspace!")
	
end)
1 Like

Pushclone is the entire model I believe, you have to iterate for each BasePart to set network ownership.

Pushclone is actually the folder that contains the push models. I am confused on what I should do, can you explain a bit more?

1 Like

So I did some testing and I came up with this 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:SetNetworkOwner(player)
				print("Set network owner to "..player.Name)
			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)

It seems to work, but when it gets to basepart:SetNetworkOwner(player), the output gives me the error: 14:58:54.140 - Can only call Network Ownership API on a part that is descendent of Workspace

Why is that?

1 Like

Well the error is self explanatory, seems like you just need to parent it into the workspace first, then do the network ownership change.

(Gotta create it before giving it to the player I guess)

Personally I never saw this error before, doesn’t seem to be in the dev api reference.

Ok, so I did this and now I get a new error…

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)

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

What do I do now???

1 Like