No comments yet. Be the first to comment!
1local ReplicatedStorage = game:GetService("ReplicatedStorage")
2
3local CollectIncomeRF = ReplicatedStorage:WaitForChild("Src")
4 :WaitForChild("Packages")
5 :WaitForChild(".pesde")
6 :WaitForChild("[email protected]")
7 :WaitForChild("knit")
8 :WaitForChild("Services")
9 :WaitForChild("KingdomService")
10 :WaitForChild("RF")
11 :WaitForChild("CollectBuildingIncome")
12
13local function isUUID(str)
14 if type(str) ~= "string" then return false end
15 return string.match(str, "^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$") ~= nil
16end
17
18local function CollectInstantly()
19 local foundUUIDs = {}
20
21 -- Ignore BaseParts to optimize performance, checking only Models and Folders
22 for _, obj in ipairs(workspace:GetDescendants()) do
23 if obj:IsA("Model") or obj:IsA("Folder") then
24 local uuid = nil
25
26 if isUUID(obj.Name) then
27 uuid = obj.Name
28 else
29 local attr = obj:GetAttribute("UUID") or obj:GetAttribute("Id") or obj:GetAttribute("BuildingId")
30 if isUUID(attr) then
31 uuid = attr
32 end
33 end
34
35 if uuid and not foundUUIDs[uuid] then
36 foundUUIDs[uuid] = true
37 end
38 end
39 end
40
41 -- Send all requests simultaneously
42 for uuid in pairs(foundUUIDs) do
43 task.spawn(function()
44 pcall(function()
45 CollectIncomeRF:InvokeServer(uuid)
46 end)
47 end)
48 end
49end
50
51CollectInstantly()