Like I know if tool has canbedropped == true and you hit backspace itl just change location to game.Workspace while canbedropped == false itl go to backpack. I want to completly change what backspace does instead of doing any of these 2. Is this possible? For example hitting backspace will delete the tool itself completly
Hello there. To answer your question, there are multiple ways to override the 2 functions you had mentioned. For this answer, I will use UserInputService. This service allows you to grab inputs from the keyboard. First, you should disable the CanBeDropped property from the tool.
local tool = script.Parent tool.CanBeDropped = false
UserInputService can be grabbed from the game to allow us to use it. To get the service, we would use:
local UIS = game:GetService("UserInputService")
Now that we have the service, we would have a function that would tell the server what to do when the key Backspace is pressed. In this case, we will destroy the tool, meaning it will be removed from the player. (Note that it won't be removed from the StarterPack if it was placed there)
function onKeyPress(inputObject, gameProcessedEvent) -- Create function if inputObject.KeyCode == Enum.KeyCode.Backspace then -- If the player pressed Backspace tool:Destroy() -- Delete the tool end end
Now that we have our function, we will create a way to call it using UserInputService.
UIS.InputBegan:connect(onKeyPress) -- UIS is the service variable we defined before. onKeyPress is the name of the function.
Now run the game and press Backspace. The tool will be removed from your player.