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

Why does this inventory gui script doesn't clone the gui "Template"?

Asked by 4 years ago

I'm trying to make a inventory gui like booga booga but the gui won't clone it self to the gui when you collect a item and there's no error in the script.

script

game:GetService("ReplicatedStorage").ItemAmount.OnServerEvent:Connect(function(player)
    for i, item in pairs((player.Inventory:GetChildren())) do
        if (not player.PlayerGui.Inventory.InventoryFrame:FindFirstChild(item.Name)) then
            local clone = game:GetService("ServerStorage"):WaitForChild("Template")
            clone.Name = item.Name
            clone.ItemName.Text = item.Name
            clone.Count.Text = item.Value


            item:GetPropetryChangedSignal("Value"):Connect(function()
                clone.Count.Text = item.Value
            end)
                clone.Parent = player.PlayerGui.Inventory.InventoryFrame
        end
    end
end)

1 answer

Log in to vote
1
Answered by 4 years ago

You forgot to write :Clone() at the end of line 04. Try this:

game:GetService("ReplicatedStorage").ItemAmount.OnServerEvent:Connect(function(player)
    for i, item in pairs((player.Inventory:GetChildren())) do
        if (not player.PlayerGui.Inventory.InventoryFrame:FindFirstChild(item.Name)) then
            local clone = game:GetService("ServerStorage"):WaitForChild("Template"):Clone()
            clone.Name = item.Name
            clone.ItemName.Text = item.Name
            clone.Count.Text = item.Value


            item:GetPropetryChangedSignal("Value"):Connect(function()
                clone.Count.Text = item.Value
            end)
                clone.Parent = player.PlayerGui.Inventory.InventoryFrame
        end
    end
end)
0
it doesn't work Eric_pokemon 133 — 4y
0
Maybe it's your RemoteEvent that isn't working. Are there any errors? youtubemasterWOW 2741 — 4y
Ad

Answer this question