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

Can't set teleport offset?

So, my script works perfect the only problem is how can I make the players teleport to the spawn's location but have it offset a little? Here's the part of code I need help with.

Player.Character:MoveTo(Spawn.Position)

1 answer

✓ Accepted answer

You can add a few studs to the position by simply adding a Vector3.new() to it. This would look something like this, but with your choice of numbers:

Player.Character:MoveTo(Spawn.Position + Vector3.new(4,0,0))

That would make the character move 4 studs away on the x axis from the spawn position. You could also make it look a little neater by setting the Vector3.new() value as a variable like this:

local offset = Vector3.new(4,0,0)

Player.Character:MoveTo(Spawn.Position + offset)

2 comments

0

But multiple players will spawn to that location at once so I needed them to spawn within a 15 stud diameter but not directly in the same place I know you can do that with math.random but I'm not sure how

0

simple, instead of setting offset as a specific set of numbers, set it as Vector3.new(math.random(1, how far you want it to go), 0, math.random(1, how far you want it to go))

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