Ad
Log in to vote
0

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

Asked by 2 months ago
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

1 answer

Log in to vote
0
Answered by 2 months ago

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:

AlvinBlox CFrame Video - https://www.youtube.com/watch?v=VxgNleUdmmg

Roblox Dev site - https://developer.roblox.com/en-us/articles/Understanding-CFrame

DevKing CFrame Video - https://www.youtube.com/watch?v=9YqN8_VERps

Let me know if my explanation makes sense, or if you need some clarification.

Ad

Answer this question