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
1 | local ClickDetector = script.Parent.ClickDetector |
2 |
3 | ClickDetector.MouseClick:connect( function (click) |
4 |
5 | click.Parent:FindFirstChild( "Torso" ) |
6 | click.Parent.CFrame = CFrame.new(- 115 , 459 , 128 ) |
7 |
8 |
9 | end ) |
If your trying to move the part its self which is what your making it sound like try:
1 | function onClicked() |
2 | script.Parent.CFrame = CFrame.new(Vector 3. new( 10 , 10 , 10 )) |
3 | end |
4 | 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:
1 | function onClicked(p) |
2 | p.Character:MoveTo(Vector 3. new( 10 , 10 , 10 )) |
3 | end |
4 | script.Parent.ClickDetector.MouseClick:connect(onClicked) |
Don't forget to change the Cord's.