I keep on getting this error even though when I disable all my DataStore scripts it still pops up.
I want to figure out which script its coming from and how to fix it
Heres my two Data Store Scripts
local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.userId
local save1 = plr.leaderstats["πΈ"]
local save2 = plr.leaderstats["π"]
local save3 = plr["π₯"]
local save4 = plr["πΌ"]
local save5 = plr["πΌπ"]
local GetSaved = ds:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
save3.Value = GetSaved[3]
save4.Value = GetSaved[4]
save5.Value = GetSaved[5]
else
local NumberForSaving = {save1.Value, save2.Value, save3.Value, save4.Value, save5}
ds:GetAsync(plrkey, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync("id_"..plr.userId, {plr.leaderstats["πΈ"].Value, plr.leaderstats["π"].Value, plr["π₯"].Value, plr["πΌ"].Value, plr["πΌπ"].Value})
end)
--[[
@author TwinPlayzDev_YT
@since 8/1/2021
@credit HowToRoblox(https://youtu.be/Be9nWHLdaQU)
This script will handles the daily rewards!
THIS CODE IS FREE TO USE TO ALL
youtube.com/c/TwinPlayz_YT
--]]
-- [ SERVICES ] --
local dss = game:GetService("DataStoreService")
local dailyRewardDS = dss:GetDataStore("DailyRewards")
local ReplicatedStorage = game:GetService('ReplicatedStorage')
-- [ LOCALS ] --
local rewardsForStreak =
{
[1] = 200,
[2] = 250,
[3] = 300,
[4] = 350,
[5] = 400,
[6] = 500,
[7] = 750,
}
local Notification = ReplicatedStorage:WaitForChild("NotificationEvent")
-- [ FUNCTIONS ] --
local function toHMS(s)
return ("%02i:%02i:%02i"):format(s/60^2, s/60%60, s%60)
end
game.Players.PlayerAdded:Connect(function(plr) -- When player joins game.
workspace.RedeemRewards.Touched:Connect(function(part)
if part.Parent.Name == plr.Name then
if part.Parent:FindFirstChild("Humanoid") then
local success, dailyRewardInfo = pcall(function()
return dailyRewardDS:GetAsync(plr.UserId .. "-DailyRewards") -- Getting Players DataSTore
end)
if type(dailyRewardInfo) ~= "table" then dailyRewardInfo = {nil, nil, nil} end
local cash = plr.leaderstats["πΈ"] -- THIS IS YOUR CURRENCY HERE
local lastOnline = dailyRewardInfo[2]
local currentTime = os.time() -- Getting Current Time
local timeDifference
if lastOnline then
timeDifference = currentTime - lastOnline
end
if not timeDifference or timeDifference >= 24*60*60 then
local streak = dailyRewardInfo[3] or 1
local reward = rewardsForStreak[streak]
cash.Value = cash.Value + reward -- Adding The Reward.
--Notification:FireAllClients( "DAILY REWARD SYSTEM : ", plr.Name.. " has just claimed their daily reward!" ) -- Notifying Clients.
local streak = streak + 1
if streak > 7 then streak = 1 end
local success, errormsg = pcall(function()
dailyRewardDS:SetAsync(plr.UserId .. "-DailyRewards", {cash.Value, os.time(), streak})
end)
elseif timeDifference then
wait((24*60*60) - timeDifference)
if game.Players:FindFirstChild(plr) then
local streak = dailyRewardInfo[3] or 1
local reward = rewardsForStreak[streak]
cash.Value = cash.Value + reward -- Adding The Reward.
Notification:FireAllClients( "DAILY REWARD SYSTEM : ", plr.Name.. " has just claimed their daily reward!" ) -- Notifying Clients.
local streak = streak + 1
if streak > 7 then streak = 1 end
pcall(function()
dailyRewardDS:SetAsync(plr.UserId .. "-DailyRewards", {cash.Value, os.time(), streak})
end)
end
end
end
end
end)
while wait(1) do
local success, dailyRewardInfo = pcall(function()
return dailyRewardDS:GetAsync(plr.UserId .. "-DailyRewards") -- Getting Players DataSTore
end)
if type(dailyRewardInfo) ~= "table" then dailyRewardInfo = {nil, nil, nil} end
local cash = plr.leaderstats["πΈ"] -- THIS IS YOUR CURRENCY HERE
local lastOnline = dailyRewardInfo[2]
local currentTime = os.time() -- Getting Current Time
local timeDifference
if lastOnline then
timeDifference = currentTime - lastOnline
end
workspace.DailyCoins.Transparency = 1
workspace.dailytext.SurfaceGui.TextLabel.Text = toHMS((24*60*60) - timeDifference)
if not timeDifference or timeDifference >= 24*60*60 then
workspace.dailytext.SurfaceGui.TextLabel.Text = "Available Now!"
workspace.DailyCoins.Transparency = 0
workspace.Chest.Top.Position = Vector3.new(-28.046, 12.228, -2.075)
workspace.Chest.Top.Orientation = Vector3.new(-50.002, 89.999, -180)
end
end
end)
Thanks