Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to transfer stuff from LocalScript to Script?

Asked by
Tiranin 45
10 years ago

I have a table which should've been used for saving the game, but I recently found out that to save it it needs to be in normal Script. Is there any way to transfer content from one script to another WITHOUT using global variables?

1 answer

Log in to vote
0
Answered by
Dummiez 360 Moderation Voter
10 years ago

You can use ModuleScripts. They are generally scripts that do not run unless you call them from the LocalScript or ServerScript by calling the global function 'require'.

The localscript or serverscript:

local printModule = require(game.ServerScriptService.ModuleScript)
printModule("Test Print") -- prints "Test Print" to output

The modulescript:

function printThis(value)
    print(value)
end

return printThis
0
Slight problem, you can't acces it from client. Tiranin 45 — 10y
Ad

Answer this question