I have a shop system that has multiple different parts to the shop. When the event is fired the local script is going to send a folder for the specific area (i.e. tools, effects, skins, dances). I’m storing these folders in ServerStorage so they don’t take up client memory. How could I access or tell the local script what folder to send to the server script?
Or rephrased, how could I have a remote event that has a parameter for a folder, and that parameter is told via LocalScript?
1 Like
You can’t send the reference from ServerStorage
to client, nor can you try to replicate anything from ServerStorage
to a single client only.
As the most simple solution, use the ReplicatedStorage
instead. It doesn’t quite hurt as much. For complex methods, you need to figure out how to compress the data and manage it with the server.
2 Likes
you could use a table to have a contents of a folder then send the tabel as parameter
1 Like
That would never be the case if the folder contains instances, which the table can only contain references to but never the instances themselves. It would cost quite a bit of data to sort the properties out, unless efficiently written.
1 Like
The value disappears for some reason.
1 Like
That would not solve the case of instances existing in ServerStorage
. The only place you can store them with clients having direct access to is the ReplicatedStorage
.
However, you could store the details of what properties those instances have uniquely and letting the client to manually instantiate the instances as accordingly after remote was fired.
1 Like
Could I use a serverscript in a UI element?
1 Like
It could work, but if you don’t want other clients to interfere(SurfaceGui(s)) and not overloading server(ScreenGui(s)), you would opt in for a LocalScript
instead.
1 Like
What do you mean by overloading server Guis? I’d only be using 1 script inside all of my UIs. Rest would be localscripts
1 Like
It depends on how the script works. The visuals should be only for LocalScripts
. However, if you’re going to manage something on server from them, you’ll need to use the remotes between. There should only be maximum of 1 server script for this, to be optimal.
What are you going to do if there are 24 clients open at once with each and one of them holding a script each? That’s extremely messy and probably ineffective. It costs the server some memory at least. That’s why LocalScripts
should be used to manage the functionalities of the UI, while the server is handling other processes in between.
2 Likes