ive tried almost everything with no luck
the bluedatastore module never respects debounce
ive tried values, attributes and they never work.
no idea
why is this problem annoying me?
because it causes to crash roblox studio for a sec every time i click the stop button
Modulescript:
local bluedatastore = {}
function bluedatastore.QueueData(arg1,arg2,originval,datastore,delays)
local folders
if not script.Queues:FindFirstChild(arg1..datastore) ~= nil then
local folder = Instance.new("Folder")
folder.Parent = script.Queues
folder.Name = arg1..datastore
folders = folder
--adding attribute
folder:SetAttribute("Debounce",false)
else
folders = script.Queues:FindFirstChild(arg1..datastore)
end
local request = Instance.new("StringValue")
request.Name = arg2
request.Parent = script.Queues:FindFirstChild(arg1..datastore)
print("fard")
for i,v in ipairs(folders:GetChildren()) do
print(v)
end
print(folders:GetAttribute("Debounce")) -- always returning "false"
if folders:GetAttribute("Debounce") == false then -- the line which always lets the queue pass
return
end
print("mogus")
folders:SetAttribute("Debounce",true)
if script.Queues[arg1..datastore]:FindFirstChild(originval.Value) then
game:GetService("DataStoreService"):GetDataStore(datastore):SetAsync(arg1,script.Queues[arg1..datastore]:FindFirstChild(originval.Value).Name)
else
game:GetService("DataStoreService"):GetDataStore(datastore):SetAsync(arg1,originval.Value)
end
task.wait(6)
folders:SetAttribute("Debounce",false)
end
function bluedatastore:RetrieveData(arg1,datastore,tonum)
if game:GetService("DataStoreService"):GetDataStore(datastore):GetAsync(arg1) then
if tonum then
return tonumber(game:GetService("DataStoreService"):GetDataStore(datastore):GetAsync(arg1))
end
return game:GetService("DataStoreService"):GetDataStore(datastore):GetAsync(arg1)
end
end
return bluedatastore
Normalscript:
local bluedatastore = require(game.ServerScriptService.BlueDataStore)
game.Players.PlayerAdded:Connect(function(plr)
local dat = bluedatastore:RetrieveData(plr,"Coins") or 0
local folder = Instance.new("Folder")
folder.Name = "leaderstats"
folder.Parent = plr
local val = Instance.new("NumberValue")
val.Parent = folder
val.Name = "Coins"
val.Value = dat
val:GetPropertyChangedSignal("Value"):Connect(function()
bluedatastore.QueueData(plr.UserId,val.Value,val,"Coins",6)
end)
end)
the part which abuses the module:
script.Parent.MouseClick:Connect(function(lol)
lol:WaitForChild("leaderstats"):WaitForChild("Coins").Value += 1
task.wait(5)
--lets see how the module will handle the abuse
while true do
lol:WaitForChild("leaderstats"):WaitForChild("Coins").Value += 5
wait(0.5)
end
end)
thanks
im abusing the module by that part, because i wanna test the debounce if its working or not
Ik there was a post of it before, but it didnt work