I made a datastored banlist, but it takes like 30 seconds before it takes effect.
CheckBan = function(plr)
local PlayerKey = "BannedUser_"..plr.userId
local DSB = game:GetService("DataStoreService"):GetDataStore(Gravity_V4._DATASTORESync.BanlistLink)
if DSB:GetAsync(PlayerKey) then
DSB:UpdateAsync(PlayerKey, function(oldValue)
local newValue = oldValue or 1
newValue=newValue+1
return newValue
end)
Gravity_V4._Connections.Broadcast(5,0,'Kicked: '..plr.Name..' for datastored ban!','Really red',nil)
Gravity_V4._Connections.Kick(plr)
end
end
local DSB = game:GetService("DataStoreService"):GetDataStore(Gravity_V4._DATASTORESync.BanlistLink)
local PlayerKey = "BannedUser_"..plr.userId
if DSB:GetAsync(PlayerKey) then
Gravity_V4._Connections.CheckBan(v)
else
DSB:SetAsync(PlayerKey,1) -- This is SLOW, but why?
Gravity_V4._Connections.CheckBan(v)
end

8 comments
Most likely the DataStore service is being overloaded.
The problem is, the only time the banlist run's is when a player enters, And the CheckBan function runs FAST.. But for some reason the setasync is slow.
Any idea's?
I'm not entirely sure if this will work, but try and implement :WaitForDataReady(). Wiki's description for this isn't too specific on its use, but I believe you can pre-load data from a given player with this player method.
But isnt :WaitForDataReady() for Data persistence not Data store?
...Thanks for specifying that. I'm not too experienced with Data Persistence, as you can see. My apologies.
No worrys. I will up rep your comment for trying to help. Hey, you learn something everyday! :P
Plus you have helped me in the past, so yea.. :)