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

[Solved] UnequipTools() on key press?

Issue resolved

local Humanoid = script.Parent:FindFirstChild("Humanoid")
function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Q then
        Humanoid:UnequipTools()
    end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

1 answer

Create a LocalScript Inside StarterCharacterScripts

local Humanoid = script.Parent:FindFirstChild("Humanoid")
function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Q then
        Humanoid:UnequipTools()
    end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

2 comments

0

That works, many thanks. I had it in StarterGui out of habit.

0

No problem bro

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