I am trying to code an effects system for my game and I cant seem to figure out how to share the values of a table to another script. Can anyone help me with this?
You can share code to another scripts with special type of scripts named ModuleScripts.
This is script in ServerScriptService.
local Items = require(script.Items)
print(Items.Item1) -- item1
print(Items.Object) -- Part
Inside that script is located ModuleScript named ‘Items’.
local yourTable = {
Item1 = 'item1',
Item2 = 'item2',
Item3 = 'item3',
Object = workspace.Part, -- your object
}
return yourTable
Right now, script have access to ModuleScript with your table. You just need to use require() method to get access to any ModuleScript. More about ModuleScripts you can read here.