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
01 | game: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 |
16 | end ) |
You forgot to write :Clone()
at the end of line 04. Try this:
01 | game: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 |
16 | end ) |