I found a bug that may reset your data.
Today when Iām casually deving in studio, it is lagging for some reason, so I chose to end the window through task manager, but later when I rejoined the session, it became this:
This is not a bug but a trade-off with the way plugin saves itās data. It stores data inside of ServerStorage (it needs to access instances, so it uses ObjectValues). But ServerStorage is a part of a place - so if you open a backup place (or autosave place) data will be the same as Eye saved at that moment.
Why I havenāt used Plugin Settings? Because itās unreliable (can be lost at some point without any reason or memory overusage) and does not allow users to access each otherās data. ServerStorage is way more reliable because itās a part of a place. But it comes with some trade-offs:
It takes up placeās memory.
Using ServerStorage thakes up gameās memory.
So if you need more memory you should consider adding a script to ServerScriptService that will destroy folder āRecPluginsā
Saving data has to be periodically.
Plugins have no way to learn when user saves the place. Thats why Eye auto-saves itās data every ~15seconds (i donāt remember exactly). So data can be not as accurate if you gonna re-open place.
Memory Leaks.
If you gonna update some folder every minute you need a way to remove old data.
:Destroy() doesnāt really fits, because if you gonna undo there will be a tons of warnings in the output. So Eye uses :Remove() and after ~30 minutes calls :Destroy() to prevent Memory Leaks. Thats why if you gonna undo action 30 minutes old there will be a ton of warnings. Sadly I havenāt found a way to solve that.
hey here to ask for a feature, currently the serverstorage names are very obtuse and give no hints for what they are for, iām currently trying to use the folder to get a total amount of seconds, but the number turns out to be way bigger then the actual number displayed in the plugin window.
(current code for calculating it btw
for i, v in ServerStorage.RecPlugins.Eye.Profiles["117236333"].Total:GetDescendants() do
if v:IsA("ObjectValue") then
result += v:GetAttribute("timeSpent")
end
end
result = daft:secondstotime(math.floor(result))
Hi! The reason of a way bigger number is that it actually stores idle time in there, just doesnāt display it. If you need to get the total time without idle time included, you need to check the action index of that time.
for i, v in ServerStorage.RecPlugins.Eye.Profiles["117236333"].Total:GetDescendants() do
if v:IsA("ObjectValue") then
-- check for action index
local actionIndex = v.Parent.Value
if actionIndex == 0 then -- if action is idle then skip this entry
continue
end
result += v:GetAttribute("timeSpent")
end
end
result = daft:secondstotime(math.floor(result))
Just to clarify, are you using this in personal script or some sort of a plugin? If you use this in plugin, I can create a much more reliable API (BindableFunction or something) to get Eyeās data. Also note that the data in the folders updates every 10-30 seconds, so it may be outdated.