Skip to content

Instantly share code, notes, and snippets.

@OverHash
Created December 11, 2019 23:35
Show Gist options
  • Save OverHash/e14cdc632829afe83318030a73e4a2dd to your computer and use it in GitHub Desktop.
Save OverHash/e14cdc632829afe83318030a73e4a2dd to your computer and use it in GitHub Desktop.
An error with DataStore2
local Players = game:GetService('Players')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local DataStore2 = require(ReplicatedStorage:WaitForChild('DataStore2'))
DataStore2.Combine('DATA', 'test')
Players.PlayerAdded:Connect(function(player)
local store = DataStore2('test', player)
store:OnUpdate(function(value)
print('Store updated with new value: '..value)
end)
while true do
store:Update(function(oldValue)
oldValue = oldValue or 0
print('Updating store. Old value was '..oldValue)
return oldValue + 1
end)
wait(5)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment