i have a bunch of parts made client side and i want to move them to server side, how do i do this?
maybe this can help:
Iterate all the objects into a table and then send it to the server by via-remote event.|
local Table = {}
local function ScanModelDescendants(Model)
-- function to scan all the descendants and then
local descendant
-- add it to the table
table.insert(Table, descendant)
end
RemoteEvent:FireServer(Table)
You can fire a RemoteEvent from the client to the server with information like the size/position of the part as parameters, and then recreate the part on the server.
Local script:
local size = part.Size
local cframe = part.CFrame
game.ReplicatedStorage.CreatePart:FireServer(size, cframe)
Server script:
game.ReplicatedStorage.CreatePart.OnServerEvent:Connect(function(plr, size, cframe)
local part = Instance.new("Part")
part.Parent = workspace
part.CFrame = cframe
part.Size = size
end)
parts created on the client will not exist on the server so you cant send them directly as objects
Its just a simple starting framework. You can easily replicate the properties of a part and then add it into a table. And then a server-script would handle the replicate of the parts by assigning the same cloned properties.
I believe it’s impossible because otherwise cheaters would have the ability to spawn in whatever they want (and they aren’t doing that).