i was making a daily reward system from the youtuber alvinblox but i got an error saying "SetASync is not a valid member of GlobalDataStore" line 62
local DataStore = game:GetService("DataStoreService"):GetDataStore("DailyRewards")
local hourWait = 24
local possibleRewards = {10,15,10,10,5,5,5,5,5,1000000,300,500,1000,100,600,5,5,75,25,80,100,1000000,5000000}
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Parent = leaderstats
local timeNow = os.time()
local data
pcall(function()
data = DataStore:GetASync(player.UserId.."-dailyReward")
print("Getting Data")
end)
if data ~= nil then
--Returning player
local TimeSinceLastClaim = timeNow - data
print("Time Since Last Claim "..TimeSinceLastClaim)
if (TimeSinceLastClaim / 3600) >= hourWait then
-- They are eligible for a reward
local reward = possibleRewards[math.random(1,#possibleRewards)]
game.ReplicatedStorage.ShowDailyReward:FireClient(player,hourWait,reward)
local connection
connection = game.ReplicatedStorage.ClaimReward.OnServerEvent:Connect(function(triggeringPlayer)
if triggeringPlayer == player then
print("Reward Claimed")
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + reward
DataStore:SetASync(player.UserId.."-dailyReward",os.time())
connection:Disconnect()
end
end)
else
print("Player Is Not Eligible Right Now")
end
else
--New player
print("New player")
local reward = possibleRewards[math.random(1,#possibleRewards)]
game.ReplicatedStorage.ShowDailyReward:FireClient(player,hourWait,reward)
local connection
connection = game.ReplicatedStorage.ClaimReward.OnServerEvent:Connect(function(triggeringPlayer)
if triggeringPlayer == player then
print("Reward Claimed")
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + reward
DataStore:SetASync(player.UserId.."-dailyReward",os.time())
connection:Disconnect()
end
end)
end
end)
--[[game.Players.PlayerRemoving:Connect(function(player)
local data
pcall(function(player)
data = DataStore:GetASync(player.UserId.."-dailyReward")
print("Getting The Data")
end)
if data == nil then
--New player
pcall(function()
local TimeVal = os.time()
DataStore:SetASync(player.UserId.."-dailyReward")
end)
print("Saved Because Your A New Player")
end
end)--]]
line 67 cuz the thing is weird for me its, the code aint going in this correctly

5 comments
This is why you don't watch AlvinBlox.
its Async not ASync
ikr
ok
change SetASync to SetAsync