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

Why does this script teleport to a random place?

Asked by
Jxyzxrr 13
5 years ago

Hello, I am trying to do a teleport script for a game that teleports to coins one by one. It doesn't really work, instead of doing that it teleports to a random place on the map. It does it for every game:

for i,v in pairs(game:GetChildren()) do
   game.Players.LocalPlayer.Character:MoveTo(Vector3.new(game.Workspace.GameObjects.Credit.Position))

end

yeah script is broken at the end. just teleports to a random place, like I said

0
full thing is there just click view source Jxyzxrr 13 — 5y
0
Depends on where credit is located. DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You may just use this:

game.Players.LocalPlayer.Character:MoveTo(game.Workspace.GameObjects.Credit.Position + Vector3.new(0,5,0))

The last bit I added is to make sure you don't tp into it so it pushes you away. It is not necessary if the coin doesn't have collision. I don't know what you were trying to do with the for loop, but this is how you would teleport. ^^

Ad

Answer this question