Created
December 11, 2019 23:35
-
-
Save OverHash/e14cdc632829afe83318030a73e4a2dd to your computer and use it in GitHub Desktop.
An error with DataStore2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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