How to make UnlockAll function

  1. What do you want to achieve? Keep it simple and clear!
    So basically i’m working on tycoon(almost 50% done) and it’s really hard to test new things each time to give yourself 1B from studio and buy everything again. So i made small admin GUI where you can unlock every thing in tycoon instantly, exactly i get some code errors i’f anybody could help me make this i will be really happy.
  2. What is the issue? Include screenshots / videos if possible!
    Described everything in first
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tryed to use function :Unlock but this didn’t really help out, i got error

Here is code of AdminManager:

local AdminFunctionEvent = workspace.Events.AdminFunction
local AdminGUIManager = workspace.Events.AdminGUIManager
local PlayerManager = require(script.Parent.PlayerManager)
local TycoonModule = require(script.Parent.Tycoon)
local DonateStuff = game:GetService("ServerStorage").DonateStuff
local Players = game:GetService("Players")
local AllowedPlayers = {
	"PhantomGame_Youtube",
	"Teroserse",
	"fgiagocf"
}
AdminFunctionEvent.OnServerEvent:Connect(function(player, Topic)
	print("Function got called! Topic:"..Topic)
	if table.find(AllowedPlayers, player.Name) then
		print("Player is Allowed!")
		if Topic == "InfMoney" then
			PlayerManager.SetMoney(player, 999999999999999999999999999999)
		elseif Topic == "UnlockAll" then
			TycoonModule.UnlockAll()
		elseif Topic == "AllGamepasses" then
			for i,stuff in pairs(DonateStuff:GetChildren()) do
				local stuffClone1 = stuff:Clone()
				stuffClone1.Parent = player.Backpack
				local stuffClone2 = stuff:Clone()
				stuffClone2.Parent = player.StarterGear
			end
		end
	end
end)

Tycoon Script which being called:

...
function Tycoon:UnlockAll()
	for _, instance in ipairs(game:GetService("ServerStorage").TycoonStorage:GetDescendants()) do -- Here is error
		print(instance)
		if CollectionService:HasTag(instance, "Unlockable") then
			local UnlockID = instance:GetAttribute("UnlockID")
			self:Unlock(instance, UnlockID) --didn't work out, i have no idea what to do
			end
	end
end
...
function Tycoon:Unlock(instance, id) -- Unlock Function
	playerManager.AddUnlockId(self.Owner, id)
	
	CollectionService:RemoveTag(instance, "Unlockable")
	self:AddComponents(instance)
	instance.Parent = self.Model	
end
...

EDIT: ID is an thing which each unlockable have, it’s used to unlock them with buttons, also all unlockables which not unlocked are in ServerStorage.TycoonStorage
EDIT2: I added ID to function and i just get this error:


EDIT3: I tryed to send this as button event, but no result Only error
image

Some things might be unavailable , Make sure they are possible

Also, what is the Button script, you did not include information on that

Well it won’t help in case i do not get instance here, so this is dumb decision

I’m using only things which are in tycoonStorage and i sort them if they have Unlockable tag, they all available.

Sorry for bump, reviving topic in case still no idea how to properly make this.

Sorry for another bump, still dead topic and have no idea what to do