Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to transfer stuff from LocalScript to Script?

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

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

1 comment

0

Slight problem, you can't acces it from client.

This discussion is preserved as it was. New answers, comments, and votes are closed.