How can I move a tool?

I have been trying to write a script to copy a tool into the workspace and move it to a specific position.
There is, however, no convenient function to move a tool. So I have been trying to set the position of the tool’s Handle.
No matter what I try, the tool does not end up at the desired location. Either the welds in the tool break, or the tool just stays where it was.

This code fails to move the tool to the desired location:

local newItem = game.ReplicatedStorage.MyTool:Clone()
newItem.Handle.Position = Vector3.new(0, 100, 0)
newItem.Parent = workspace

This code breaks the welds that holds the tool together:

local newItem = game.ReplicatedStorage.MyTool:Clone()
newItem.Parent = workspace
newItem.Handle.Position = Vector3.new(0, 100, 0)

Why isn’t this working and how can I fix it?

8 Likes

You just need to set the CFrame instead of the Position:

local newItem = game.ReplicatedStorage.MyTool:Clone()
newItem.Handle.CFrame = CFrame.new(0, 100, 0)
newItem.Parent = workspace

As a side note, the most recent release notes say they’re changing how setting CFrames works. It probably won’t make a difference for you though.

6 Likes

That didn’t work either, but in this order it did work:

local newItem = game.ReplicatedStorage.MyTool:Clone()
newItem.Parent = workspace
newItem.Handle.CFrame = CFrame.new(0, 100, 0)
7 Likes

I get an error when doing that: