#memorystore service issue
1 messages · Page 1 of 1 (latest)
bro
it might be not showing errors bc ur pcalls are catching them hold on
is this a server script
no it is in startergui
ok
i can remove pcall
now output is 1
do this as a server script
while task.wait(1) do
local memstore = game:GetService("MemoryStoreService")
local queuename = game.JobId.."GenQueue"
local queue = memstore:GetQueue(queuename)
print("check 1")
local data = queue:ReadAsync(10, false, 2)
local temparr = {}
local truecount = 0
if data then
for i = 1, #data do
if table.find(temparr, tostring(data[i])) == nil then
print("ind: "..tostring(i).." val: "..tostring(data[i]))
table.insert(temparr, tostring(data[i]))
truecount += 1
end
queue:RemoveAsync(data[i])
end
end
for i, v in pairs (game:GetService("Players"):GetChildren()) do
local label = v:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextLabel") -- Make this the path to your own text label
label.Text = 'Generators Active: '..tostring(truecount)
end
end
and i recommend
** You are now Level 17! **
thats not broken part
if it is in a pcall it doesnt need waitforchild
i replaced the local script with this server script in serverscript service and it works
third parameter is timeout
its how long it takes until it gives up waiting
yeah but 20 seconds is pretty long for a text gui that is updating every second and needs 10 values
if you timeout early then it wont get the data if latency is high
updating every second prevents mass calls
instead of less than a second
its supposed to only have a maximum of three values. my removeasync is not working properly to cull the duplicate values from the queue
ok
it is receiving values but it is behaving even more strangely than before
i just tested this and it worked for me
local memstore = game:GetService("MemoryStoreService")
local queuename = game.JobId.."GenQueue"
local queue = memstore:GetQueue(queuename)
for i=1, 10, 1 do
queue:AddAsync("hi", 10, i)
end
while task.wait(1) do
local data = queue:ReadAsync(10, false, .1)
local temparr = {}
local truecount = 0
if data then
for i = 1, #data do
if not(table.find(temparr, tostring(data[i]))) then
print("ind: "..tostring(i).." val: "..tostring(data[i]))
table.insert(temparr, tostring(data[i]))
truecount += 1
end
queue:RemoveAsync(data[i])
end
end
for i, v in pairs (game:GetService("Players"):GetChildren()) do
local label = v:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextLabel") -- Make this the path to your own text label
label.Text = 'Generators Active: '..tostring(truecount)
end
end
it only printed hi once
nvm
weird
no i think it just caught it before the last hi deleted bc hi was third in queue idk
bc after that it didnt print anything else
meaning all of them expired
bc queue is first in first out right?
local memstore = game:GetService("MemoryStoreService")
local queuename = game.JobId.."GenQueue"
local queue = memstore:GetQueue(queuename)
for i=1, 10, 1 do
queue:AddAsync("hi", 10, i)
end
queue:AddAsync("hello", 10, 11)
queue:AddAsync("yo", 10, 12)
while task.wait(1) do
local data = queue:ReadAsync(10, false, .1)
local temparr = {}
local truecount = 0
if data then
for i = 1, #data do
if not(table.find(temparr, tostring(data[i]))) then
print("ind: "..tostring(i).." val: "..tostring(data[i]))
table.insert(temparr, tostring(data[i]))
truecount += 1
end
queue:RemoveAsync(data[i])
end
end
for i, v in pairs (game:GetService("Players"):GetChildren()) do
local label = v:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextLabel") -- Make this the path to your own text label
label.Text = 'Generators Active: '..tostring(truecount)
end
end
this is what i tested
I think its just bc queue is first in first out and it caught it at that specific moment i will add "x added/removed" print statements to see
yes maybe it is something odd with the queue. currently i am treating it like a list
yes do that
WAIT
i done it
nvm
WHAT IS WRONG WITH THIS MEMORYSTORE
bro this is seriously messing with my head
it is
it is bc the repeats stayed in the queue and were added after one was removed
how
i want nothing to be returned by the readasync
it is still reading items in the queue after iterating through all and removing them
oh its last in first out
bro
it is saying there is nothing in the queue and then the next iteration is has everything existing in the queue
clearly nothing is being removed
made it work i think
showw
only thing is when data has nothing in the table it prints as nil i think thats just how it shows up
local memstore = game:GetService("MemoryStoreService")
local queuename = game.JobId.."GenQueue"
local queue = memstore:GetQueue(queuename)
local pastarr = {}
for i=1, 10, 1 do
queue:AddAsync("hi", 10, i)
end
queue:AddAsync("hello", 10, 11)
queue:AddAsync("yo", 10, 12)
while task.wait(1) do
local data = queue:ReadAsync(10, false, .1)
print(data)
--local preserved = {}
--for i, v in pairs(data) do
-- table.insert(preserved, i, v)
--end
local temparr = {}
local truecount = 0
if data then
for i = 1, #data do
if data[i] then
if not(table.find(temparr, tostring(data[i]))) then
print("ind: "..tostring(i).." val: "..tostring(data[i]))
table.insert(temparr, tostring(data[i]))
truecount += 1
print("Removing "..data[i])
queue:RemoveAsync(data[i])
else
print("Duplicate found! "..tostring(data[i]))
queue:RemoveAsync(data[i])
table.remove(data, i)
end
end
end
for index=1, #pastarr, 1 do
if not(table.find(data, pastarr[index])) then
print(pastarr[index].." was removed")
end
end
pastarr = {}
for i, v in pairs(temparr) do
table.insert(pastarr, v)
end
end
for i, v in pairs (game:GetService("Players"):GetChildren()) do
local label = v:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextLabel") -- Make this the path to your own text label
label.Text = 'Generators Active: '..tostring(truecount)
end
end
does it repeat the value?
after?
mine seems to result in "nil" "items... removed" "nil" "items... removed"
it oscillates
mine just repeats nil bc of this
local data = queue:ReadAsync(10, false, .1)
print(data)
i just fixed this thing where the duplicates that came after all data was deleted just now by moving temp array outside
idk
local memstore = game:GetService("MemoryStoreService")
local queuename = game.JobId.."GenQueue"
local queue = memstore:GetQueue(queuename)
local pastarr = {}
for i=1, 10, 1 do
queue:AddAsync("hi", 10, i)
end
queue:AddAsync("hello", 10, 11)
queue:AddAsync("yo", 10, 12)
local add_value = coroutine.wrap(function()
task.wait(15)
queue:AddAsync("howdy", 10, 13)
queue:AddAsync("e", 10, 14)
queue:AddAsync("well", 10, 15)
end)
add_value()
local temparr = {}
while task.wait(1) do
local data = queue:ReadAsync(10, false, .1)
--print(data)
--local preserved = {}
--for i, v in pairs(data) do
-- table.insert(preserved, i, v)
--end
local truecount = 0
--print(temparr)
if data then
for i = 1, #data do
if data[i] then
if not(table.find(temparr, tostring(data[i]))) then
print("ind: "..tostring(i).." val: "..tostring(data[i]))
table.insert(temparr, tostring(data[i]))
truecount += 1
print("Removing "..data[i])
queue:RemoveAsync(data[i])
else
print("Duplicate found! "..tostring(data[i]))
queue:RemoveAsync(data[i])
table.remove(data, i)
end
end
end
--for index=1, #pastarr, 1 do
-- if not(table.find(data, pastarr[index])) then
-- --print(pastarr[index].." was removed")
-- end
--end
pastarr = {}
for i, v in pairs(temparr) do
table.insert(pastarr, v)
end
end
for i, v in pairs (game:GetService("Players"):GetChildren()) do
local label = v:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextLabel") -- Make this the path to your own text label
label.Text = 'Generators Active: '..tostring(truecount)
end
end
i commented out the prints
there is a coroutine that i used for testing'
if i am getting oscillating values then i dont know if anything can save me
** You are now Level 6! **
what folder did you place your script in
i just put it in serverscriptservice
but one flaw i noticed is that my script will not let a value repeat at all if it sees it once so u cant ever use the same value twice
lemme see
i dont have any values in tho
i dont either
i just spawn and suddenly i have data in the queue
yeah i get nil at first and the next one is data
then nil then data
like wtf have i done
there is literally no code to add data
lol try changing the name of the store
ik memory store or whatever persists across servers at the same time and thats why its used so thats probably why u had alternating results
i am on roblox studio there should only be one instance
unless collaberator mode messes with the instances
it works now
with my code
lowered timeout like you recommended
i wonder if it works in startergui
or maybe
maybe i leave it in server and use firstchild
im steal some of ur codes
hehe
bro
...
just needed an extra waitforchild
since i used a screengui parent for textlabel
SIUUUU
it works
party time
not YET
aaaaa
that is only the storing of values
i still need to implement the mechanism of what the player sees. that was only the back end
atleast now
it is most likely exploit proof
and it is actually pretty fast :3
well party time for me bc i can finally go do my chores so my parents dont get mad at me
cya 👍
no idea
same