How to make a key press tool

I am making a scary game and I want the player to have a lighter to see their way in the dark but I don’t want it to be a tool. I would like for the player to press a key and the character holds up the lighter.

I already know how to make Keypress events I just don’t know how to make the player hold up an object without using a tool

Would animations work here? I’m not really an expert in this section, but I think animations would do what you want. Weld the lighter to the player, then use a animation to make the player hold it up.

I am not very familiar with welding, how does it work?

Welding means you stick (or weld) to parts together. Here’s the documentation, along with the code to weld objects at the bottom of the page.

Another alternate way, if you’re not that comfortable with welding, is to make the lighter into a tool, then disable the default roblox inventory with code, so the player can’t equip it with the 1 2 3 keys. Then bind code that equips the lighter to the player to the keypress. That is, assuming you are not already using the roblox default backpack system in your game.


I looked over the weld API reference and I am confused, I like your second solution a lot better, I am not using the normal backpack in the game so that wont be a problem, do you know where I could learn about disabling the backpack and rebinding the keys?

1 Like

You could put the tool straight into the character when the key is pressed instead of putting the tool in the backpack.

There is a function called SetCoreGuiEnabled that allows you to disable roblox core gui.

And to equip/unequip a tool with code:

1 Like

Sounds like it would work, where would you recommend I keep the tool when it’s not in the character?

Just clone it from wherever you keep all of your tools, like replicated storage.

1 Like