Inventory to surface via click

Hey everyone! I just have a question regarding inventory.

How would I go about equipping an item, and clicking on a surface, then unequip said item onto surface. I also need to bind the action to either a button, or a key, but I can figure that out.

Basically kind of like this. Guy buys drink. Equips drink. Clicks on a table and the Tool is placed there for others to pick up.

I’ve scoured the forums best I could and can’t seem to find any information on it. The most information I could find is use Mouse.target and Moveto(). I’ve tried to do it myself but might need a little help. I’m sure I’m overlooking how to do it. This would be the first instance of me doing something like this. If anyone can point me in the general direction that would be awesome!

1 Like

Clone the tool and place it at the position of the item a player clicks on when a mouse click is detected.

You can use Player:GetMouse(), however I would suggest using a raycast system paired with UserInputService as Player:GetMouse() is deprecated and might not work correctly on mobile devices.

Does it have to be locked into a specific position? I’m trying to make them be able to just, put it on a counter. Not in a specific spot.

Just move it to that position but keep it unanchored.

If you want, you can randomize the position relative to the object the player clicked on.

1 Like