Basically I need a way or something like _G that is shared across clients and the server, And I do need it to be a table
And for it to be auto updated like in the example below
-- LocalScript
local X = {"MintIceCream"}
_G.INFO = X
X.INFO[1] = "ChocolateIceCream"
-- ServerScript
local X = _G.INFO
Print(X)
-- Output: ChocolateIceCream
-- (output is just an example and its not actually wokring since its a localscript to serverscript)
It said "ChocolateIceCream" even though in the localscript i set _G.INFO = X before changing the X[1] to "ChocolateIceCream"
I do know if _G.INFO is nil i can just put a event and do shenanigans
local Globals = {}
warn("Loaded!")
--==//Services\\\==--
local rs = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local debris = game:GetService("Debris")
local Modules = game:GetService("ReplicatedStorage"):WaitForChild("Modules")
local IsLoaded = false
--==//Globals\\\==--
function Set()
local Remotes = rs:WaitForChild("Remotes")
for _,v in ipairs(Remotes:GetChildren()) do
_G[v.Name] = Remotes:WaitForChild(v.Name)
end
for _,v in ipairs(Modules:GetChildren()) do
if v:GetAttribute("Blacklisted") then continue end
_G[v.Name] = require(v)
end
IsLoaded = true
end
--==//----\\\==--
_G.rs = rs
_G.debris = debris
_G.players = players
Globals["Client"] = function()
_G.player = players.LocalPlayer
_G.Camera = game:GetService("Workspace").CurrentCamera
end
function Globals:Wait()
Set()
repeat task.wait()
until IsLoaded
end
--[[
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Starter_Module = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("Global"))
Starter_Module:Wait()
if character then
warn('Loaded')
_G["Skills"]:SetUp()
_G["Skills"]["Gojo"]()
end
]]
return Globals
Client
local Starter_Module = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("Global"))
Starter_Module:Wait()
Server
local Starter_Module = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"):WaitForChild("Global"))
Starter_Module:Wait()
I dont know how module scripts actually working like, I dont know you can update/store things on there. The thing is I already made the variables and the functions on the localscript
RemoteFunction.OnServerInvoke = function(Player, Operation, Key, Value)
if not Storage[Player] then Storage[Player]={} end;
if Operation == 'WRITE' then
Storage[Player][Key] = Value; return true;
elseif Operation == 'READ' then
return Storage[Player][Key] or nil;
end;
end;
I dont think I can really use that since that’s really close to a datastore, And its not going to work, My only idea is a table shared across a server/clients nothing more
I do have an idea, I dont know how to do it though. Its that the server has a table and the client has a different one, so when the client table changes/updates it overwrites the server table and the other way around.
Oh you did that to make it secure for other clients, I were making the server size 1 and its not for that reason only, The only reason I have it on a script is because I needed to use Loadstring