Easiest way to create Parts on the client-side?

I currently am working on a ‘Find The’ game and it requires client-sided Parts. Server-sided parts won’t do the trick.

What’s the easiest way to create Parts on the client-side? (Meaning every player in the game has their own copy of every part in the game.)

Hi! I was thinking perhaps using Replicated Storage might do the trick here, since every client will have a copy of the items from Replicated Storage, and I believe you can still access parts through the client through the client’s copy of Replicated Storage. This shouldn’t affect the server since it is all client sided, but if you need to update the server, you can always utilize Remote Events to update the server. Additionally, I am pretty sure the client has their own copy of workspace as well, where clients can make changes as they please, which shouldn’t affect the server either. In terms of replicating client actions so other clients can see is something you would need to do server side. Hope this helps!

1 Like

Thank you! That helped me :slightly_smiling_face:

But I was thinking of storing ALL the parts inside ServerStorage and then writing that code in a LocalScript

game.Players.PlayerAdded:Connect(function(player)
	for _, v in pairs(game.ServerStorage:GetChildren()) do
		if v:IsA("Part") then
			v.Parent = workspace
		end
	end
end)

Might that do the trick either?

Glad to hear it helped! Unfortunately, I don’t think you can access ServerStorage through the Client, so in case you want the Client to access the parts, its best to keep them in Replicated Storage.

However!

You can also make a serverscript to clone the parts into workspace, then I believe you can manipulate the parts without affecting the server or other clients. Because in that case, the LocalScript can access the Client’s workspace.

1 Like

Like this?

game.Players.PlayerAdded:Connect(function(player)
	for i, v in pairs(game.ReplicatedStorage:GetChildren()) do
		if v:IsA("Part") then
			local AllParts = v:Clone()
			AllParts.Parent = workspace
		end
	end
end)

Pretty Close! I would remove the game.Players.PlayerAdded:Connect(function() end) since, I believe Client scripts execute automatically, so the script should run no problem and just keep the for loop.

1 Like

Alright.

Thank you so much for your help!

1 Like

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