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

Whats wrong with this Script?

Asked by
faruque 30
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

The script is post to select two random players and then teleport them when countdown timer say "Start Match" then teleport them to their positions .

players = game.Players:GetChildren()

if script.Parent.Text=="Start Match" then
players[math.random(1, #players)]:MoveTo(70.4, 213.6, 28.8)-- Position 1
players[math.random(1, #players)]:MoveTo(66, 213.599, 46.8)--Position 2
end

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

Looking at the Wiki article on MoveTo, it requires a Vector3 for the destination.

Instead, you have given it three numbers -- so that can't be right.


We make a Vector3 using the Vector3.new(x,y,z) constructor, so your MoveTo method calls should look like:

(...):MoveTo(Vector3.new(x,y,z))

instead of

(...):MoveTo(x,y,z)
Ad

Answer this question