0

# I am having a problem with teleporting a tool with coordinates?

Edited 2 months ago

I'm trying to make it so when you touch this button, the tool clones itself and teleports to these coordinates (-98.839, -111.395, -59.275) but I can't figure it out. My script:

game.Workspace.spawnbutton.Transparency = 0
local clone = game.Workspace.RoomKey:Clone()
local KEYDOOR = game.Workspace.RoomKey
script.Parent.Touched:Connect(function()
game.Workspace.spawnbutton.Transparency = 1
clone.Parent = workspace
clone:SetPrimaryPartCFrame(CFrame.new(246.009, 3.819, 252.988))
wait (3)
game.Workspace.spawnbutton.Transparency = 0
--script.Parent.ClickDetector.MouseClick:Connect((onclick))
end)

0
The tool doesn't have the ':SetPrimaryPartCFrame' function; only 'Models' do. Try teleporting the tool's handle. DiamondComplex 270 — 2mo

0

Your defining CFrame incorrectly. CFrame contains both position and orientation. ex.

local CFrame = CFrame.new(position, orientation)


In addition when defining information like position you need to do so as a Vector3, which are their own data type. ex.

Part.Position = Vector3.new(10,15,20)


In your case, I would suggest editing the position of the tool rather than its CFrame, this is just cause personally I'm not too experienced and I don't understand some of the more nuanced functions of CFrame. But if your dead set on using CFrame I would suggest looking online for some more on how to use CFrame such as: