Well I have a RemoteEvent, the server sends a table variable with objects to every client.
Then I have a Localscript for each client using .OnClientEvent on the RemoteEvent so they can get the table.
This is what I did to solve it,
--LocalScript local Event=Game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") Event.OnClientEvent:connect(function(ObjectTable) Data=ObjectTable end)
I don't like using Global variables however, I personally don't feel comfortable using them... Is there a another way so the variable can be returned via function connected to the event or something? Important: This variable updates every single second
You could use a RemoteFunction to return a value (or values). But if you want to use RemoteEvents, you can just always declare Data as a local variable before hand so when the event is invoked, you can just set it.
--LocalScript local Event=Game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") local Data; Event.OnClientEvent:connect(function(ObjectTable) Data=ObjectTable end)