How do I find if a tool has any activating inputs being held?

  1. What do you want to achieve? Keep it simple and clear!
    I want a check to be made after debounce is set back to false to read if any inputs that can trigger Tool.Activated are being held.

  2. What is the issue? Include screenshots / videos if possible!
    I cannot find a way to do this.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes, but all of them were only for computer mouse inputs.

Elsewise, please tell me what inputs can trigger Tool.Activated. Thank you.

1 Like

Just to be clear you want to know when a tool is being activated?

If so all you have to do is create a function for when the tool is activated:

  -- stuff here

Also, any click from a device activates a tool. For example, left click on a computer, a press on the screen on mobile, and the right trigger on Xbox are all inputs that can activate a tool!

Hope this helped, if you still have any questions let me know!

I want to know when an input to activate a tool is being held, not starting the input to activate it. I’ll use what you told me about pressing the screen on mobile and the right trigger for controllers to make the function work.
Quick question, can you check if a bool is changed using .Changed?

My apologies on the misunderstanding.

Yes, but I suggest using GetPropertyChangedSignal(“Value”) as .Changed could activate for a property other than the value.

Try doing this:

	-- your code here

Minor issue with what you are telling me to do with GetPropertyChangedSignal.

debounce is inside the script. Sorry for this misunderstanding but, would this still work? (debounce still holds bool value, so will it work?)

No, property changed event is only for object properties, not booleans

1 Like

Just make a new bool value object or set an attribute to the object…

I looked more into this, try using userinputservice, it can look something like this:

local uis = game:GetService("UserInputService")
hold = false -- not local because it is a global variable

   local inputType = input.UserInputType
   if inputType == Enum.UserInputType.MouseButton1 then
        hold = true

   local inputType = input.UserInputType
   if inputType == Enum.UserInputType.MouseButton1 then
        hold = false

Hope that works, if not I can try to help further!

I believe they dont have a input type for Xbox but for mobile you would change:




Let me know if that works!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.