I am having a problem with when a table value you changes. I know you need to do it for when the object or table changes but I want it so only if the value changes.
local PlayerData = game:GetService("DataStoreService"):GetDataStore("PlayerData") local DataRemote = game.ReplicatedStorage.DataStore.RemoteEvent local FunctionModule = {} local List = {} --Player Added Functions game.Players.PlayerAdded:connect(function(Player) local Level = 1 local Experience = 0 table.insert(List,Level) table.insert(List,Experience) local ID = Player.userId local Data = PlayerData:GetAsync(ID) PlayerData:SetAsync(ID,List) List[2].Changed:connect(function() if List[2] >= List[1]*10 then List[2] = List[2] - (List[1]*10) List[1] = List[1] + 1 end end) end)
--[[ERROR 22:11:02.177 - ServerScriptService.DataBase:17: attempt to index field '?' (a number value) 22:11:02.179 - Stack Begin 22:11:02.180 - Script 'ServerScriptService.DataBase', Line 17 22:11:02.182 - Stack End --]]