Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Whats wrong with this Script?

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.