#Clearing player's folder
1 messages · Page 1 of 1 (latest)
if you want it to clear over and over over a bit of time you can use a while loop like so:
-- optional: cache some stuff
local cache = {};
-- main
while task.wait(60) --[[time in seconds]] do
print("Cleared!");
for i, v in path.to.folder:GetChildren() do
-- everything except Destroy() is part of caching, if you dont want to cache you can remove that
cache = {};
table.insert(cache, v.Name);
v:Destroy()
end
end
-- in the rest of the code you can access the folder like normal OR the old item names from the cache, code wont run after the while loop but you can put it in a coroutine.wrap() to make it run after
but i would recommend caching some data
game:GetService("Players"):GetPlayers()
Thanks
if you want to get all players do waht this guy said and use a for loop to iterate over it
what does cache do?
just store the data here
its optional but
it stores the old version
ok