So i want it so when i click this part (the parent of the script) it teleports to the coordinates. im not sure if it just doesnt know what the parent of click is or im doing it wrong completely
local ClickDetector = script.Parent.ClickDetector ClickDetector.MouseClick:connect(function(click) click.Parent:FindFirstChild("Torso") click.Parent.CFrame = CFrame.new(-115, 459, 128) end)
If your trying to move the part its self which is what your making it sound like try:
function onClicked() script.Parent.CFrame = CFrame.new(Vector3.new(10,10,10)) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
If that's what your trying to accomplish I don't know why you referenced the Torso.
If your trying to move the player then use this:
function onClicked(p) p.Character:MoveTo(Vector3.new(10,10,10)) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Don't forget to change the Cord's.