I have a GUI and an image button that is once pressed, it will give the player a "Shotgun" and a "Pistol", So the players don't abuse it and get infinite guns, How could I Make it so that it clears the player's backpack completely and then gives the player the two guns, I can't just say tool:destroy()because there are multiple guns in the game like an AK and a sniper so it wouldn't be convenient to do a tool:destroy() for every gun in the game anyways here's the code
script.Parent.MouseButton1Click:Connect(function() --Click detector
game.ReplicatedStorage.Shotguns.Shotgun:Clone().Parent =
game.Players.LocalPlayer.Backpack --Shotgun Giver
game.ReplicatedStorage.Pistols.Pistol3:Clone().Parent =
game.Players.LocalPlayer.Backpack --Pistol Giver
script.Parent.Parent.Visible = false --Sets the frame status to invisble
game.SoundService.Barret_Equip.Playing = true --Plays reload sound effect
end) --Note this is a *local script*

1 comment
Omg TYSM Ziannea, you just answered my problem, I wanted this answer for so long. and again I thank you for your comment