-
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. -
What is the issue? Include screenshots / videos if possible!
Described everything in first -
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