How to send an instance from client to server

First make an RemoteEvent in ReplicatedStorage:
image
and name it ‘InstanceRequest’
Then use a roblox serializer module:
I recommend you use: https://www.roblox.com/library/8919881565/
And to be able to get the module, run this code in command bar:

game:GetObjects('rbxassetid://(your module asset id here)')[1].Parent = game:GetService('ReplicatedStorage')

And now you should have this:
image
You should have a roblox serialize module inside ReplicatedStorage
Next Step:
Make a script in ServerScriptService called ‘InstanceCreateClient’ or whatever you want it to be called
And the script should look like:

game:GetService('ReplicatedStorage').InstanceRequest.OnServerEvent:Connect(function(Player, InstanceString, Parent)
	require(game:GetService('ReplicatedStorage').RBLXSerialize).Decode(InstanceString, true).Parent = Parent
end)

Now in client:
Client script or you can run code in command bar:

local Instance_ = game:GetService('CoreGui').RobloxGui
local Parent = workspace
game:GetService('ReplicatedStorage').InstanceRequest:FireServer(require(game:GetService('ReplicatedStorage').RBLXSerialize).Encode(Instance_, true), Parent)

If you run the code, check the workspace service in explorer.

3 Likes

If you want to use the recommended roblox seralizer then run

game:GetObjects('rbxassetid://8919881565')[1].Parent = game:GetService('ReplicatedStorage')

in the command bar. :slightly_smiling_face:

I highly recommend reading this.