The tool model I have is a bunch of parts grouped together and a Handle. When the player holds the tool, it shows the tool and teleports them to the place where I built it. When I make the parts unanchored, it just makes the player hold on to the handle while it shows the rest of the tool fall apart and die where I built it. How can I get the tool to stick to the player’s hand?
Hello. For that, you will have to well all of the parts together. Select all the parts, go to model tab, and you should find a button to create constraint in the constraints section. Click the drop down button and select weld constraint.
See if all is really unchored and if isnt exist welds on anchored parts.
you may need to weld the tool in order to prevent it
Do I have to click on every individual part in the physical editor?
You can hold Ctrl and select from the explorer or you can run a macro on the run command line.
Run this in the command line
local Model = --Model Directory
local Handle = --Handle Directory
for _, v in pairs(Model:GetDescendants()) do
if v:IsA("BasePart") then
local Weld = Instance.new("WeldConstraint",v)
Weld.Part0 = v
Weld.Part1 = Handle
end
end
I put a script inside of the tool, and pasted that code in. I added the Model directory and Handle directory. The script didn’t do anything but it didn’t print any errors.
Run it in the command line in studio
It is either visible at the very bottom of the window, or you can turn it on in view tab.
I did that and it said Line 1: attempt to index nil with parent
I directed the model using “script.Parent.Cupcake” but I guess the model or script doesn’t exist?
If you run it in the command line it would start of with workspace.
You will have to use the actual hierarchy with respect to the DataModel in the run command line.
Oh wait. I used “print()” and turns out the script didn’t run at all.
The tool is located in replicated storage by the way, when the game starts it just clones it into the player’s backpack
Could be starter pack, or ServerStorage or ReplicatedStorage too.
Step 1. Copy the script and put the directories according to the hiearchy you have.
It would look something like this
(workspace.CupcakeModel)
Step 2. Put the script in the command bar in studio
Step 3. Run the code
I already did do that, and it returned an error.
I found out the problem is that the actual script in the replicated storage doesn’t run at all.
Can you send me a screenshot of how you do it?
This is where the script is located
Here is what’s inside the script (Doesn’t run)