You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I’m trying to make it that when a Player Presses a Gui Button It will clone their Gui Frame, With Their Own Modifications (Which Were Made On the client) To A SurfaceGui On the server So everyone Can See it.
What is the issue? Include screenshots / videos if possible!
I Do not know how to Get The player’s Modifications Cloned Onto The Server.
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I’ve Checked But, None Of the topics I’ve seen answer My Problem
I’ve tried RemoteEvents But I do not understand how to call/fire them in a LocalScript and how to receive then in a ServerScript.
This Is what I Am Currently Using. It clones the part But not the modification that were made on the Client.
script.Parent.print1.MouseButton1Click:Connect(function()
local printededitframe = script.Parent.Parent.EditFrame:Clone()
local printedimage = script.Parent.Parent.Image:Clone()
printededitframe.Parent = workspace.Print1.background
printedimage.Parent = workspace.Print1.background -- Print1 Is A Part In the workspace. background Is The surfaceGui in Print1
end)
To simplify, use a remote event to communicate with the server if you want to clone a GUI from the client to the server. Remember that the server doesn’t know what exists on the client, you will need to send over the properties of whatever GUI you have, or create another GUI under ReplicatedStorage and clone it from there.
You want the GUI to exist inside the ReplicatedStorage before you have all this code running. Remember what I said before that the server does not know what is happening on the client side. You can use a remote event to clone the GUI that you will be placing into the ReplicatedStorage before you run the game.
To answer your replied question, the server cannot tell if you clone the client’s GUI into ReplicatedStorage. Trying to clone this in the server will result in nil (does not exist).
It kind Of works But the problem Is that I have a Local script which Clones A ImageLabel Onto A Frame In The Client’s Gui And The server Does not see It. And When The player Is Cloning that Frame With the ImageLables The Cloned Frame Shows Up Blank.
This makes sense in regards to what I have said earlier. I guess what is happening here is you have cloned something that already exists in the server, so you have attempted to clone and broadcast this onto the server which they can see what they had initially on the server, but whatever was newly made by the client cannot be broadcast over to the server as that element is made in the client.
In summary, you cloned something the server already has. The server can read the original GUI. However, whatever you cloned on the local script cannot be read by the server.
You need to use RemoteEvents. The server can only read data and not instances. For example, you create a part on the client. If you pass in the part for it to be cloned onto the server, this will not work because the server does not know what that part is as it only appears on the client. However, if you pass the part’s size, the server will be able to read this as data and use it to make whatever you want it to make.
Oh ok. But what If there’s Multiple Instances Like A lot? Would I have to Pass The Data For each One Or Would I have To Make A Script Or RemoteEvent That Would Read The Data?
What you could do is make a function that loops through the properties and have them placed inside a table. Next, pass that table and the class name of whatever instance you are working with and have that be replicated on the server side. With that information, you can loop through each and every property in the table and apply that to your new cloned object. If I remember though, exploiters can use RemoteEvents to access things from client to server. Like I said before, have these already made inside ReplicatedStorage so you wouldn’t have to go through the method I have mentioned above.