When changing a table variable, it doesn't return the new values at all?

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)

1 Like

Hi, your code is very difficult to understand. This makes it hard and frankly less interesting to help you. Would you like some help making your code more readable?

Sorry for late response
I edited the post, hope its better to understand!

Oh wait, i found the problem, i had a selection system that changes an value in the script to that button, but i never changed it back to nil, so it kept going for the data that turned to nil.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.