Placing an object in a specific place

So basically I have a problem. I don’t know how to make a tool that I can place in a specific place by clicking on it. Like for example, You have a tool and you have to click on the table to put it on that table. Please someone send something that can help me

2 Likes

You could make an already existing model on the table and make it completely invisible. When the player clicks on it, the tool from their inventory gets removed, and the model on the table becomes visible.
You can achieve this using Transparency on every part inside the model, or just place the model inside the ReplicatedStorage and you can clone it into the workspace whenever it needs to appear.

The second solution is to create an Attachment on the table where the tool should be, and when the player clicks, remove the tool from their character and weld it to that attachment.

3 Likes

Could you explain this a little bit more precisely, i came back to roblox studio after like 2 years and i dont really get it

1 Like

I think this is the best idea, and just to add, I would prefer to Clone() the model only, and Destroy() the tool in character. Not placing the tool directly on the table, removing everything that makes it work as a tool, just place the meshes/parts etc.
And when grabbing the “tool” from table, clone() a new tool from SS and give it to player

4 Likes

I agree, but it could be that the tools can be customised or something which makes them unique, and if there are a lot of possible changes then it would be inefficient to have a model for every single change. But of course, this is just a possibility, that’s why I provided both solutions. I also would prefer making a different model and cloning it

3 Likes

Well, the model in tool could be customized and having many parts/meshes. On click of the table, the script could grab only the model/mesh/parts and Clone() and place the entire model, then destroy() the tool from character.

3 Likes

So, create a model that looks exactly like your tool, but isn’t a tool (only a group of parts). It doesn’t need to have a handle or scripts or anything that makes the original tool work.

Now place this model exactly where you want it to be on the table. When you’re done, move the model from the workspace to the ReplicatedStorage.

Now, when the player clicks on the table, you can use :Destroy() on their tool, and then :Clone() the model that you put in the ReplicatedStorage and set its Parent to workspace

3 Likes

I would like to explain the second idea that WoTrox had, which to me, seems the best one, with a slitght improvement.

When player “clicks table”, check if player is holding a tool, if yes, read the model or mesh/parts in the tool, clone that model, and place it on table, by checking what attachments in table are free. I would suppose the table should contain certain amount of “slots” to place tools. So the model gotten from the tool is cloned and placed on a free slot in table. Then destroy() the tool in character.

Addionally you could include another ClickDetector into the new model on table, so player can click it to get back the tool

3 Likes

how do i use destroy or clone? im sorry im confused, ive seen some videos on youtube but none helped

Tool:Destroy()
local clone = Tool.Model:Clone()
clone.Parent = Table

You will need more than only understanding Destroy() and Clone(), depending on the approach you chose to develop.

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