Here's my script:
---//SE-006 Script made by Cyotokatrov\\--- -- kk let's begin. while tool.Selected == false do --we want our victim to keep the tool lol. tool.Selected = true end x = game.Workspace player = game.Players.LocalPlayer tool = script.Parent print("Loaded.") tool.Selected:connect(function(m) m.KeyDown:connect(function(key) print("Key pressed: "..key) end) end)
I made a while loop so the script would automatically check if the tool is unselected, although it doesn't work.
There is already a property for this. In your tool, go to your properties. Unselect "CanBeDropped." Alternatively, to use it in a script, you can access the property.
local tool = script.Parent tool.CanBeDropped = false
If you want to be sure that a tool can never be deselected, first disable the CanBeDropped
property.
In a LocalScript, you will need to remove the backpack HUD so the tool can't be manually deselected by clicking on it or pressing a number.
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)