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 5 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

01game:GetService("ReplicatedStorage").ItemAmount.OnServerEvent:Connect(function(player)
02    for i, item in pairs((player.Inventory:GetChildren())) do
03        if (not player.PlayerGui.Inventory.InventoryFrame:FindFirstChild(item.Name)) then
04            local clone = game:GetService("ServerStorage"):WaitForChild("Template")
05            clone.Name = item.Name
06            clone.ItemName.Text = item.Name
07            clone.Count.Text = item.Value
08 
09 
10            item:GetPropetryChangedSignal("Value"):Connect(function()
11                clone.Count.Text = item.Value
12            end)
13                clone.Parent = player.PlayerGui.Inventory.InventoryFrame
14        end
15    end
16end)

1 answer

Log in to vote
1
Answered by 5 years ago

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

01game:GetService("ReplicatedStorage").ItemAmount.OnServerEvent:Connect(function(player)
02    for i, item in pairs((player.Inventory:GetChildren())) do
03        if (not player.PlayerGui.Inventory.InventoryFrame:FindFirstChild(item.Name)) then
04            local clone = game:GetService("ServerStorage"):WaitForChild("Template"):Clone()
05            clone.Name = item.Name
06            clone.ItemName.Text = item.Name
07            clone.Count.Text = item.Value
08 
09 
10            item:GetPropetryChangedSignal("Value"):Connect(function()
11                clone.Count.Text = item.Value
12            end)
13                clone.Parent = player.PlayerGui.Inventory.InventoryFrame
14        end
15    end
16end)
0
it doesn't work Eric_pokemon 133 — 5y
0
Maybe it's your RemoteEvent that isn't working. Are there any errors? youtubemasterWOW 2741 — 5y
Ad

Answer this question