Hello!
I am having trouble getting the item I want to drop.
I can get an item to drop, specifically, it drops the first item on the list, Bandage or Ammo but I want to be more precise with dropping the item you specifically clicked.
Any help please?
OptionMenu.Drop.MouseButton1Down:Connect(function() --local ObjItem = Bin.Background.Backpack:FindFirstChildWhichIsA("GuiButton") for i,v in pairs(Player.Backpack:GetChildren()) do if v:IsA("Tool") then if v:FindFirstChild("Type") ~= nil and v.Type.Value == "Medical" then DropItemEvent:FireServer(v) Dropped:Play() OptionMenu.Visible = false break elseif v:FindFirstChild("Type") ~= nil and v.Type.Value == "Ammo" then DropItemEvent:FireServer(v) Dropped:Play() OptionMenu.Visible = false break end end end end)
Try this;
for x,z in pairs(OptionMenu.Drop:GetChildren()) do z.MouseButton1Down:Connect(function() --local ObjItem = Bin.Background.Backpack:FindFirstChildWhichIsA("GuiButton") for i,v in pairs(Player.Backpack:GetChildren()) do if v:IsA("Tool") then if v:FindFirstChild("Type") ~= nil and v.Type.Value == "Medical" then DropItemEvent:FireServer(v) Dropped:Play() OptionMenu.Visible = false break elseif v:FindFirstChild("Type") ~= nil and v.Type.Value == "Ammo" then DropItemEvent:FireServer(v) Dropped:Play() OptionMenu.Visible = false break end end end end) end