Inside of my game i have a datastore and it keeps dropping requests is there anyway to fix this? this is the datastore.
local Datastore = game:GetService("DataStoreService")
local CaseBuxStorage = Datastore:GetDataStore("CaseBuxData")
local RAPStorage = Datastore:GetDataStore("RAPData")
game.Players.PlayerAdded:Connect(function(Player)
local Data = Instance.new("Folder", Player)
Data.Name = "leaderstats"
local CaseBux = Instance.new("IntValue", Data)
CaseBux.Name = "CaseBux"
local RAP = Instance.new("IntValue", Data)
RAP.Name = "RAP"
local CurrentCaseBux = CaseBuxStorage:GetAsync(Player.UserId)
print(CurrentCaseBux)
local CurrentRAP = RAPStorage:GetAsync(Player.UserId)
print(CurrentRAP)
if CurrentCaseBux == nil then
CurrentCaseBux = 0
end
if CurrentRAP == nil then
CurrentRAP = 0
end
CaseBux.Value = CurrentCaseBux
RAP.Value = CurrentRAP
CaseBux.Changed:Connect(function(NewValue)
CaseBuxStorage:SetAsync(Player.UserId, NewValue)
end)
RAP.Changed:Connect(function(NewValue)
RAPStorage:SetAsync(Player.UserId, NewValue)
end)
end)

3 comments
could you give me an example of using :BindToClose()?
I've edited it into my post so its readable
okay thank you!