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

How to teleport a part ?

Asked by
xdeno 187
8 years ago

I know how to teleport a person and there are many scripts that do that, but I'm trying to teleport a ball when it touches an object named ground it will teleport me back to a certain position.

2
The ball will teleport the player back to a certain position or it will teleport the ball? MrLonely1221 701 — 8y
0
Yeah, could you explain please? User#11440 120 — 8y
0
It will teleport the player back to a certain position but thinking of it now I also need to teleport to ball or reset it to it's starting position. xdeno 187 — 8y
0
"need to teleport the* ball" xdeno 187 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago
ball = balllocationhere
ballname = "NameOfBallHere" --Change this to the name of the ball, make sure the name is unique.

script.Parent.Touched:connect(function(hit)
    if hit.Name == ballname then 
        --Figure out the rest of the code from here
end)

I went ahead and threw down some beginning code for you. I don't know exactly what it is you're trying to do, so you'll have to figure out the rest, which should be pretty simple.

0
Thank you so much, I have been trying to figure it out for ages but I'm new aha, really appreciate your answer, so happy now :P xdeno 187 — 8y
0
No problem xxxXMrsAwesomeXxxx 70 — 8y
Ad
Log in to vote
0
Answered by 8 years ago
Part.CFrame=CFrame.new()

For both the player and ball you can use this.

0
Sorry, I'm new to scripting. I'm not sure if I'm doing the correct method for the use of that line, but I'm using function onTouch and my problem is it only works when the player is touching the part, where as I'm looking for the script to only work with the ball touches the part, thank you for the reply though ! xdeno 187 — 8y
0
Use an OnTouched connected function that will check to see if the name of the object it touches it the name of the Ball. xxxXMrsAwesomeXxxx 70 — 8y

Answer this question