Hi, I'm using userinputservice. I wanted to know how to make it only track input when a tool is equipped, I tried the script below but it just didnt register at all when equipped. I'm out of ideas for it lol
local uis = game:GetService("UserInputService")
local attacking = false
script.Parent.Equipped:connect(function()
input1 = uis.InputBegan:connect(function(input, gp)
if gp then
return
else
if input.KeyCode == Enum.KeyCode.Q then
print("pressed")
end
end
end)
input2 = uis.InputEnded:connect(function(input, gp)
if gp then
return
else
if input.KeyCode == Enum.KeyCode.Q then
print("released")
end
end
end)
end)
script.Parent.Unequipped:connect(function()
input1:Disconnect()
input2:Disconnect()
end)

5 comments
I responded back in a seperate answer
You should do this instead, because the Equipped event is supposed to fire the "moment" you equipped the tool, and it doesn't keep on firing as long as your holding it it doesn't keep on firing
indent!!!
Indent your code
Oh ffs, another simon cowelss of answer, didnt you reas? I wrote them using a phone geniuses