So I have a few scripts that deal with points if a player does a task correctly. When they get a point the value changes and the game auto-saves the leaderboard, but when the point is given, the points spike and go up fast adding way more than what’s in the code (Which is set to +1)
In the output bar, this error will show up: 302: SetAsync request dropped. Request was throttled, but throttled request queue was full?
DATASTORAGE & LEADERBOARD SCRIPT
local dataStoreService = game:GetService("DataStoreService")
local cashData = dataStoreService:GetDataStore("CashData")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local rank = Instance.new("StringValue")
rank.Name = "Rank"
rank.Value = player:GetRoleInGroup(3598436)
leaderstats.Parent = player
rank.Parent = leaderstats
local cash = Instance.new("IntValue")
cash.Name = "Points"
cash.Value = cashData:GetAsync(player.UserId) or 0
cash.Parent = leaderstats
cash.Changed:Connect(function()
cashData:SetAsync(player.UserId,cash.Value)
end)
end)
And here’s the script to the part if the task is finished
TASK SCRIPT (INSIDE PART)
script.Disabled = true
wait(240) -- time it takes to appear at the start
script.Parent.Transparency = 0.7
script.Disabled = false
script.Parent.Surface.Enabled = true
local size = 0
script.Parent.Touched:Connect(function(Hit)
local player = game.Players:GetPlayerFromCharacter(Hit.Parent.Parent)
if player then
if size == 3 then
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
script.Parent.Transparency = 1
script.Disabled = true
script.Parent.Surface.Enabled = false
wait(240) -- time it takes to appear again
script.Disabled = false
size = 0
script.Parent.Transparency = 0.7
elseif size == 0 then
script.Parent.Size = Vector3.new(0.2, 3.4, 5)
wait(2)
size = 1
elseif size == 1 then
script.Parent.Size = Vector3.new(0.1, 2.4, 3.5)
wait(1)
size = 2
elseif size == 2 then
script.Parent.Size = Vector3.new(0.1, 1.4, 2)
wait(1)
size = 3
end
end
end)
Any known fixes?