i think this is the problem, there is two donation board in my game with the same data store and stuff.
if there are 2 boards then are there 2 things of scripts? you would probably need to rename the datastore in one of them then, try temporarily getting rid of one board and see if anything different happens
yes there is two board but one script and i dont know how to rename datastore i want it to be the same board with the same data store in a different place
oh ok, if the score script is in the board this isn’t an issue, but in the score script try to just make the wait at second to last line something like wait(60) instead of having it be related to the datastore and other things
put it in the last line or under wait(refreshTime * 40)
?
replace wait(refreshTime * 40) with it
do it to both, if the warning is still there it shouldn’t really be a problem
increase the time more to like 90 seconds, also can you should me where the score updater script is and how many there are?
also it may be worth looking into datastore:updateAsync. you could use this in the update and settings script as its more stable, and since the datastore doesnt have a unique key for the player it would be less prone to breaking, as SetAsync can be buggy when multiple servers try doing it at once
and 90 second not working to
the more important question is are both boards working
also make sure you have enable studio access to api services on, as datastores wont work in studio without that on
dude i think i know the source of the problem when i delete my checkpoints script there was no error of the donation board.
checkpoints:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SkipStage = ReplicatedStorage:WaitForChild("SkipStage")
local Checkpoints = workspace:WaitForChild("Checkpoints")
local inGameStartupPlayers = {}
local CurrentStage = {}
local CurrentPoints = {}
local TouchDb = {}
local ProductId = 1145455293
local Products = {
{
ProductPrice = 5, --The price from the Developer Product.
ProductId = 1141211330 -- The ID from the Developer Product.
},
{
ProductPrice = 25, --The price from the Developer Product.
ProductId = 1141214738 -- The ID from the Developer Product.
},
{
ProductPrice = 50, --The price from the Developer Product.
ProductId = 1141214866 -- The ID from the Developer Product.
},
{
ProductPrice = 100, --The price from the Developer Product.
ProductId = 1141214989 -- The ID from the Developer Product.
},
{
ProductPrice = 1000, --The price from the Developer Product.
ProductId = 1141215192 -- The ID from the Developer Product.
},
{
ProductPrice = 10000, --The price from the Developer Product.
ProductId = 1198678406 -- The ID from the Developer Product.
},
{
ProductPrice = 100000, --The price from the Developer Product.
ProductId = 1198678352 -- The ID from the Developer Product.
},
}
local function NewCharacter(player, char)
local TempCurrentStage = CurrentStage[player.UserId]
if TempCurrentStage ~= nil then
local TempCheckpoint = Checkpoints:FindFirstChild(TempCurrentStage)
if TempCheckpoint ~= nil then
repeat wait(0.1) until char.PrimaryPart ~= nil
char:SetPrimaryPartCFrame(CFrame.new(TempCheckpoint.Position + Vector3.new(0, 3, 0)) * CFrame.Angles(0, math.rad(TempCheckpoint.Orientation.Y) + math.rad(90), 0))
end
end
end
local DSS = game:GetService("DataStoreService")
local myDataStore = DSS:GetDataStore("myDataStore")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Points = Instance.new("IntValue")
Points.Name = "Points"
Points.Parent = leaderstats
local Stage = Instance.new("IntValue")
Stage.Name = "Stage"
Stage.Parent = leaderstats
Stage.Value = 1
local data
local success, errormessage = pcall(function()
data = myDataStore:GetAsync(player.UserId.."-Points")
end)
if success then
Points.Value = data
else
print("There was a error whilst loading your data")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
myDataStore:SetAsync(player.UserId.."-Points",player.leaderstats.Points.Value)
end)
if success then
print("Player data successfully saved!")
else
print("There was an error when saving data")
warn(errormessage)
end
end)
local function NewPlayer(player)
CurrentStage[player.UserId] = 1
local TempChar = player.Character
if TempChar ~= nil then
NewCharacter(player, TempChar)
end
player.CharacterAdded:Connect(function(char)
NewCharacter(player, char)
end)
end
Players.PlayerAdded:Connect(function(player)
if inGameStartupPlayers[player] == nil then
NewPlayer(player)
end
end)
Players.PlayerRemoving:Connect(function(player)
CurrentStage[player.UserId] = nil
end)
SkipStage.OnServerInvoke = function(player)
local connection
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats ~= nil then
local Stage = leaderstats:FindFirstChild("Stage")
if Stage ~= nil then
if #Checkpoints:GetChildren() ~= Stage.Value then
local PurchaseResult = "Purchase Failed"
connection = MarketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, purchased)
if player.UserId == userId and productId == ProductId then
if purchased == true then
PurchaseResult = "Success"
end
end
connection:Disconnect()
end)
MarketplaceService:PromptProductPurchase(player, ProductId)
repeat wait(0.1) until connection.Connected == false or Players:GetPlayerByUserId(player.UserId) == nil
return PurchaseResult
else
return "You have reached the highest stage!"
end
end
end
end
MarketplaceService.ProcessReceipt = function(recieptInfo)
local player = Players:GetPlayerByUserId(recieptInfo.PlayerId)
-- Don't grant purchase if the player left or is not here for whatever reason
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if recieptInfo.ProductId == ProductId then
CurrentStage[player.UserId] = CurrentStage[player.UserId] + 1
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats ~= nil then
local Stage = leaderstats:FindFirstChild("Stage")
if Stage ~= nil then
Stage.Value = CurrentStage[player.UserId]
end
end
local TempChar = player.Character
if TempChar ~= nil then
NewCharacter(player, TempChar)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
-- Loop through the product data
for _, productData in ipairs(Products) do
-- if the productData's productId matches the prouct being purchased's id then continue
if productData.ProductId == recieptInfo.ProductId then
-- Since IncrementAsync can error we wrap it in a pcall (protected call)
local success, err = pcall(function()
game:GetService("DataStoreService"):GetOrderedDataStore("TopDonators"):IncrementAsync(player.UserId, productData.ProductPrice)
end)
-- If it errored we wanna know what went wrong
if success then
return Enum.ProductPurchaseDecision.PurchaseGranted
else
warn("Failed to increment amount donated. Error thrown: " .. err)
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
end
return Enum.ProductPurchaseDecision.NotProcessedYet
end
for i,v in pairs(Checkpoints:GetChildren()) do
local StageNum = tonumber(v.Name)
v.Touched:Connect(function(hit)
local char = hit.Parent
if char ~= nil then
local Humanoid = char:FindFirstChildOfClass("Humanoid")
if Humanoid ~= nil and Humanoid.Health > 0 then
local player = Players:GetPlayerFromCharacter(char)
if player ~= nil and (TouchDb[player.UserId] or 0) + 1 <= os.time() then
TouchDb[player.UserId] = os.time()
local TempCurrentStage = CurrentStage[player.UserId]
if TempCurrentStage == StageNum - 1 then
CurrentStage[player.UserId] = StageNum
local TempLeaderstats = player:FindFirstChild("leaderstats")
if TempLeaderstats ~= nil then
local TempStage = TempLeaderstats:FindFirstChild("Stage")
if TempStage ~= nil then
TempStage.Value = StageNum
end
end
end
end
end
end
end)
end
inGameStartupPlayers = Players:GetPlayers()
for i,v in pairs(inGameStartupPlayers) do
spawn(function()
NewPlayer(v)
end)
end
local Skip = ReplicatedStorage:WaitForChild("Skip")
local players = game.Players:GetPlayers()
local finish = 0
Skip.OnServerInvoke = function(player)
local players = game.Players:GetPlayers()
local finish = 0
for i=1, #players do
if finish == 0 then
finish = 1
players[i].leaderstats.Stage.Value = players[i].leaderstats.Stage.Value + 1
players[i].Character:MoveTo(Checkpoints:FindFirstChild(players[i].leaderstats.Stage.Value).Position)
end
end
end
inGameStartupPlayers = {}
i dont think that that script should be causing the warning, does this warning happen in game? the checkpoint script only uses datastores when the player joins and leaves.
try looking for other uses of datastore in all of your scripts
but there is two like of this script idk.
can you open Find/Replace all in the view section, then put DataStoreService in the search bar in find/replace and then show me all the scripts that use it
DUDE THANK YOU SO MUCH I LOVE YOU the leader board was the problem.
How can I give you back what you gave me? you help so much and you wasted your time for me so much dude you are a you’re a legend
this is the script of the leaderboard how do i fix the problem without delete the leaderboard
script:
local ds = game:GetService("DataStoreService")
local coinsODS = ds:GetOrderedDataStore("CoinsStats")
local timeUntilReset = 10
while wait(1) do
timeUntilReset = timeUntilReset - 1
script.Parent.Parent.ResetTime.Text = "Resetting in " .. timeUntilReset .. " seconds..."
if timeUntilReset == 0 then
timeUntilReset = 10
for i, plr in pairs(game.Players:GetPlayers()) do
coinsODS:SetAsync(plr.UserId, plr.leaderstats.Points.Value)
end
for i, leaderboardRank in pairs(script.Parent:GetChildren()) do
if leaderboardRank.ClassName == "Frame" then
leaderboardRank:Destroy()
end
end
local success, errorMsg = pcall(function()
local data = coinsODS:GetSortedAsync(false, 50)
local coinsPage = data:GetCurrentPage()
for rankInLB, dataStored in ipairs(coinsPage) do
local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
local coins = dataStored.value
local template = script.Template:Clone()
template.Name = name .. "Leaderboard"
template.PlrName.Text = name
template.Rank.Text = "#" .. rankInLB
template.Coins.Text = coins
template.Parent = script.Parent
end
end)
end
end