#need help user input service

1 messages · Page 1 of 1 (latest)

worn mist
#

so i want to make a script where if i press Q while the tool is activated, it will do something. i tried this, but it doesnt work so idk

strong carbon
#

input.KeyCode == Enum.KeyCode.Q

#

also

#

next to input

#

add new string

#

"Input,CanProced"

#

and next to keycode.Q

#

put "and not canproced"

strong carbon
#

if you dont do this it will activate when also typing in chat

#

and other things

#

oh and also

woven current
#

isnt there supposed to be
game:GetService("UserInputService")
?

strong carbon
strong carbon
#

to make it work when equipped

woven current
strong carbon
#

he maybe just put on top of the script

worn mist
worn mist
strong carbon
#

make just a variable "equipped = false" and when tool equips it will be true, when unequips false. So then just add "if equipped == true then"

worn mist
#

alr ill try this

strong carbon
#
local equipped = false
tool.Equipped:Connect(function()
    equipped = true
end)
tool.UnEquipped:Connect(function()
    equipped = false
end)
userinputsevice.InputBegan:Connect(function(input,cantproc)
    if equipped == true and input.KeyCode == enum.KeyCode.Q and not cantproc then
    -- code
    end
end)
#

@worn mist

#

@worn mist

#

@worn mist

worn mist
#

it still doesnt work

#

idk y

strong carbon
#

share me error code?

lean zephyr
#

and writes .UnEquipped 🥀

strong carbon
#

its does it work

lean zephyr
#

no 🥀

#

its Unequipped 🥀

strong carbon
#

Welp, FOR ME it always worked

strong carbon
#

discord doesn't have auto type or how to name it

lean zephyr
#

no worries

strong carbon
strong carbon
lean zephyr
#

you also can do this

#

(emptyVar :: Tool).nowItHasAutoType

worn mist
#

it just doesnt do anything