So, I have a function on the client that gets a table from the server via a Remote Function, at first all works well. Then I also have another function that gets the value, changes it and returns the new value back to the server for saving and receiving it in other scripts. But once I do it the second time, the value it returns isn’t changed + won’t change
for the people that don’t understand or want a more Indepth look, here is both scripts cut down to the more interesting parts
server script:
local data = {}
game.ReplicatedStorage.Game.Events.GetPlayersData.OnServerInvoke = function()
return data
end
game.ReplicatedStorage.Game.Events.UpdateData.OnServerEvent:Connect(function(plr,newdata)
data = newdata
end)
How i got the data in a localscript:
local recieveddata = game.ReplicatedStorage.Game.Events.GetData:InvokeServer()
edit: edited some things to make it easier to read (btw, these are not completed scripts as i know the rest works)