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)

3 comments
what?
Try replacing both of the "FindFirstChild" on line 5 and 10 with "WaitForChild" since it is finding the first item.
replaced line 5 and line 10 with recommandation, no change, same results.