Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years 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:

01game.Workspace.spawnbutton.Transparency = 0
02local clone = game.Workspace.RoomKey:Clone()
03local KEYDOOR = game.Workspace.RoomKey
04script.Parent.Touched:Connect(function()
05    game.Workspace.spawnbutton.Transparency = 1
06    clone.Parent = workspace
07    clone:SetPrimaryPartCFrame(CFrame.new(246.009, 3.819, 252.988))
08    wait (3)
09    game.Workspace.spawnbutton.Transparency = 0
10    --script.Parent.ClickDetector.MouseClick:Connect((onclick))
11    end)
0
The tool doesn't have the ':SetPrimaryPartCFrame' function; only 'Models' do. Try teleporting the tool's handle. DiamondComplex 285 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

1local 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.

1Part.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