How to send Data or Information from one script to another

Dear Developers,
I wanted to ask if there would be a way to send Data, Tasks, Information from one script to another one.
Example:
local script sends - Information / Task / Function / Item name > to a script

The impotant thing is Item Names or Values.
Like:
local script sends (from StarterGui) - Item Name / Value / Gui Name - > to a script (in workspace) , so it can check and configure it (for saving, etc.)

Thank you for reading; Im happy for every suggestion / help!

8 Likes

Use RemoteEvents. You have a LocalScript in StarterGUI, it fires a RemoteEvent to the server. The server then reads the parameters and does what it needs to that you can code yourself.

3 Likes

Try researching about global variables, that might help.

1 Like

Adding on to this, there’s already lots written about it. This kind of stuff is a simple search away:

5 Likes

global variables, such as b = 1, are only accessible to the script it’s defined in. If you’re referring to _G, no, don’t use it: using _G isn’t practical, and you won’t even be able to send data from server > client with this because _G can only share data among scripts with the same context level (script, local script)

@grimm0rep This question has been asked many times, please search the devforum or anywhere else before you post

5 Likes

Read this article about Remote Functions and Events, as it can help you send data in parameters through FilteringEnabled. With Remote Functions, you can send data from LocalScripts to server Scripts, or vice versa; doing all of this through FilteringEnabled on, so you can prevent most exploits, and filter what data can or can not be transmitted between scripts. I hope this works as a solution! :sweat_smile:

11 Likes

Thank you everyone for your replies!
I will update you if my script is working.

1 Like

Alright, I hope it does; if it works, maybe make a solution to the post? Thanks for replying! :wink:

3 Likes

Please maintain your original thread. You have posted about this problem in a different thread. Keep one thread to one problem.

Hello, i’m trying to send information from one server script to another server script is there already a solution of that? if so can u tell me, thank you.

You can use BindableEvents or structure your game with ModuleScripts instead so that it’s possible to pass information to that ModuleScript either via a function, a BindableEvent or a custom signal class.

3 Likes

I am trying to send a players username from one client-side script to another client-side script how could I go about this?