I have a slight working data store script but it keeps throttling my stores and i dont know how to fix it, here is my script
local DataStore = game:GetService("DataStoreService") local ds = DataStore:GetDataStore("CashSaveSystem") game.Players.PlayerAdded:connect(function(player) local leader = Instance.new("Folder",player) leader.Name = "leaderstats" local Spins = Instance.new("IntValue",leader) Spins.Name = "Spins" Spins.Value = ds:GetAsync(player.UserId) or 0 ds:SetAsync(player.UserId, Spins.Value) Spins.Changed:connect(function() ds:SetAsync(player.UserId, Spins.Value) end) end) game.Players.PlayerRemoving:connect(function(player) ds:SetAsync(player.UserId, player.leaderstats.Spins.Value) end)
I'm making a simulator game with rapid clicking so it's getting a lot of requests and it's causing it to not save anything. Any help would be appreciated :P
The code you provided wouldn't be throttled. It's only called when a player is added or removed. If you are being throttled, it's because, like you said yourself, you have other code that you didn't post here that is being called many times in a row by clicks. You are exceeding the limits. You'll have to hold back on the requests. Add waits so you can't click many times in a row or cache information locally.