DataStore request was added to queue. If request queue fills, further requests will be dropped

How to fix that warning: DataStore request was added to queue. If request queue fills, further requests will be dropped

script:

local DataStoreService = game:GetService("DataStoreService")

local Redtraildatastore = DataStoreService:GetDataStore("RedTrailDatastore")

game.Players.PlayerAdded:Connect(function(Player)

local RedTrail = Instance.new("IntValue")

RedTrail.Parent = Player:WaitForChild("Trails")

RedTrail.Name = "RedTrail"

RedTrail.Value = 0

local Data = Redtraildatastore:GetAsync(Player.UserId)

if Data then

RedTrail.Value = Data

end

end)

--------------------------------Autosaving part----------------------------------------

game.Players.PlayerRemoving:Connect(function(Player)

Redtraildatastore:SetAsync(Player.UserId, Player.Trails.RedTrail.Value)

end)

i really need help

Change this to:

local Redtraildatastore = DataStoreService:GetDataStore(“RedTrailDatastore”, “trailStorage”)

Also you should use pcalls on Set and Get async.

Its just a warning that if the queue is filled, additional data may not save and may result in breaking the whole script.

You can avoid it by wrapping it in pcall function.

1 Like

how to do that “Pcall function”?

1 Like