Hey everyone I’m currently working on an Inventory System and rn I got the Problem that when I have a tool equipped it gets duplicated because of a Clone function this is what happens when I let the Clone function and when I delete the Clone function
BEFORE:
AFTER:(IT DOESN’T ACCEPT ITEMS ANYMORE AND IT STAYS LIKE THAT)
local InventoryEvent = game.ReplicatedStorage.Remotes.InventoryEvent
local itemFrame = script.Parent:FindFirstChild("ItemsFrame")
InventoryEvent.OnClientEvent:Connect(function(ItemName, Value)
if Value == true then
local ItemButton = script.Parent.ItemsFrame.ItemButton:Clone()--Clone function I need to stop from cloning my Items
ItemButton.Visible = true
ItemButton.Name = ItemName
ItemButton.Text = ItemName
ItemButton.Parent = itemFrame
local equipButton = script.Parent.EquipFrame["EquipButton"]
ItemButton.MouseButton1Click:Connect(function()
script.Parent.EquipFrame.Title.Text = ItemName
script.Parent.EquipFrame.Title.Visible = true
equipButton.Visible = true
end)
end
end)