I'm trying to make something that detects & upgrades any weapon that is actually selected, and while I can figure out how to get an unselected item from a players backpack and replace it; I can't figure out the concept behind actually detecting what a player currently has selected in their backpack real-time.
player.Backpack:FindFirstChild"gun1":Destroy() game.ServerStorage.gun2:Clone().Parent = player.Backpack
The tool the player has equipped is a child of the player's character.
game:GetService("Players").LocalPlayer.Character:FindFirstChildWhichIsA("Tool")