Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would i make this like a tycoon Dependency?

Asked by 6 years ago

I'm making a gui so if you click purchase on "type 1" for example then "type 2" will appear so you can buy but if the the same object has the same Dependency then two "types" will appear like tycoons but it won't work it dosen't clone the Dependency frame it dosen't clone anything the values in the workspace isnt there anything wrong on it's exactly like it's in the script

heres the script:

yOffset1 = 0
yOffset2 = 0
yOffset3 = 0
yOffset4 = 0
yOffsetBase = 50
local plr = game.Players.LocalPlayer

--script.Parent.Parent.baseFolder.storeBase.base_item:Clone()
local itemG = script.Parent.baseFolder.storeBase.base_item
function createItem(store, itemType, name, cost, location, id)
    item = script.Parent.baseFolder.storeBase.base_item:Clone()
    item.Parent = script.Parent.storeFolder:FindFirstChild(store)

    item.isActive.Value = false 
    item.isItemPurchased.Value = false
    item.itemType.Value = itemType
    item.itemLocation.Value = tostring(location)
    item.itemID.Value = id
    item.itemCost.Value = cost
    item.itemName.Value = tostring(name)

    if itemType == 1 then   
        item.Position = UDim2.new(0, 0, 0, yOffset1)
        yOffset1 = yOffset1 + 50    
    elseif itemType == 2 then
        item.Position = UDim2.new(0, 0, 0, yOffset2)
        yOffset2 = yOffset2 + 50
    elseif itemType == 3 then
        item.Position = UDim2.new(0, 0, 0, yOffset3)
        yOffset3 = yOffset3 + 50
    elseif itemType == 4 then
        item.Position = UDim2.new(0, 0, 0, yOffset4)
        yOffset4 = yOffset4 + 50
    end     
end

createItem('storeTycoon', 1, 'Dropper 1', 0, 'dropper_A', 0)
--createItem('storePasses', 3, '2x Cash', 25, '', 471096709)
item.buttonPurchase.MouseButton1Down:connect(function()
    for _,v in pairs(workspace:WaitForChild("tycoon_"..plr.Name).tycoonPurchases:GetChildren()) do
        if v:FindFirstChild("purchaseOrder") then
            coroutine.resume(coroutine.create(function()
                if workspace:WaitForChild("tycoon_"..plr.Name).tycoonPurchases:WaitForChild(v.purchaseOrder.Value) then
                    print(v.purchaseOrder.Value)
                    createItem('storeTycoon', 1, item.Name, 0, v.PurchaseOrder.Value, 0)
                end
            end))
        end
    end
end)
0
Make a bool value that checks if you have certain items saSlol2436 716 — 6y

Answer this question