Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

DataStore request was added to queue?

Asked by 4 years ago

I made this script for my Ban GUI


local ReplicatedSorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local DataStoreService = game:GetService("DataStoreService") local GetDataStore = DataStoreService:GetDataStore("BanUser") local BanPlayer = ReplicatedSorage:WaitForChild("BanPlayer") local Settings = require(ReplicatedSorage:WaitForChild("Setting")) local DataStoreSuccess = {} local Banned = {} Players.PlayerAdded:Connect(function(Player) local Success,Res = pcall(function() return GetDataStore:GetAsync(Player.UserId) end) if not (Success) then DataStoreSuccess[Player.UserId] = false Player:Kick("DataStoreFailed") end if (Success and Res) then Banned[Player.UserId] = true Player:Kick("You are Banned") end end) Players.PlayerRemoving:Connect(function(Player) if (DataStoreSuccess[Player.UserId] == false) then DataStoreSuccess[Player.UserId] = nil Banned[Player.UserId] = nil end if(Banned[Player.UserId]) then return end end) BanPlayer.OnServerInvoke = function(Admin,Type,UserString) if not (Settings)[Admin.UserId] then return "You are not an admin!" end local UserId if (tonumber(UserString)) then UserId = tonumber(UserString) elseif (tostring(UserString)) then local Success,Res = pcall(function() return Players:GetUserIdFromNameAsync(UserString) end) if Res and Success then UserId = Res end end if not(UserId) then return "Player does not exist" end local Success,Res = pcall(function() GetDataStore:SetAsync(UserId,Type) end) if (Success) then return "Player Has been Banned" else return Res end end

And then I did this script to go inside the ScreenGUI

wait(1 + math.random())

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContextActionService = game:GetService("ContextActionService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Admins = require(ReplicatedStorage.Setting)
local BanPlayer = ReplicatedStorage.BanPlayer
local Sp = script.Parent
local Main = Sp.Frame
local Ban = Main.Ban
local Unban = Main.Unban
local User = Main.User
local Error = Main.Error

function BanUser(Type)
    local Message = BanPlayer:InvokeServer(Type,User.Text)

    if (Message) then
        Error.Visible = true
        Error.Text = Message
        wait(3)
        Error.Visible = false
    end
end

Ban.MouseButton1Down:Connect(function()
    BanUser(true)
end)

Unban.MouseButton1Down:Connect(function()
    BanUser(false)
end)


function Visibility()
    if not (Admins[LocalPlayer.UserId]) then
        return
    end
    Main.Visible = not Main.Visible
end

LocalPlayer.Chatted:Connect(function(Message)
    if (string.lower(Message) ==  "/bpanel") then
        Visibility()
    end
end)

ContextActionService:BindAction("BanFrameVisiblity", function(InputName, InputStats, InputKeys)
        if (InputStats == Enum.UserInputState.Begin) then
                Visibility()
        end
    end,false,Enum.KeyCode.E,Enum.KeyCode.ButtonA)

The issue is that an error keeps coming up saying "DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 45059373" and I don't know how to fix this or even what the issue is. This happens when I try to ban someone.

0
I didn't look at your code yet, but I can tell you that error happens when you attempt to access the Datastore too much. SteelMettle1 394 — 4y
0
How would I resolve this? User#29585 0 — 4y
0
Try using MouseButton1Click instead of MouseButton1Down SteelMettle1 394 — 4y
0
Nope, still has that error. User#29585 0 — 4y
View all comments (7 more)
0
how often are you clicking? royaltoe 5144 — 4y
0
Just once, when I click it one time the error still comes up. If I click it two it will say the same error but with (x2) at the end. User#29585 0 — 4y
0
Also, When I ban someone it takes about 3 minutes to actually ban them. User#29585 0 — 4y
0
are you sure you're not calling the datastore somewhere else royaltoe 5144 — 4y
0
Do you have an auto saver that’s what caused mine to repeatedly give me this error EnzoTDZ_YT 275 — 4y
0
Try changing: local GetDataStore = DataStoreService.... to this: local TheDataStore = DataStoreService... I'm wondering if it's getting confused. If that doesn't work then try to put print("Test") directly in front of your SetAsync to see how many "Test" 's print out. SteelMettle1 394 — 4y
0
Only if you're positive you don't have other datastore calls like royaltoe and EnzoTDZ_YT pointed out. SteelMettle1 394 — 4y

Answer this question