Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to detect that a player has a specific item selected in their backpack?

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

1 answer

✓ Accepted answer

The tool the player has equipped is a child of the player's character.

game:GetService("Players").LocalPlayer.Character:FindFirstChildWhichIsA("Tool")

1 comment

0

Ah, thank you. I didn't know that it automatically makes selected tools a child.

This discussion is preserved as it was. New answers, comments, and votes are closed.