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

Getting all the possible positions of x and z axis on a part?

Asked by 3 years ago

Im trying to make a automatic spawn where

I automatically spawn people ontop of a baseplate

But I can't figure out how to get all the exact positions for x and z axis of a part

I want to drop people ontop of the baseplate by like 10 studs high

I can do that but

I just need help getting all the possible positions of the x and z axis on a baseplate.

0
What do you mean by "all the possible positions", do you mean you want to randomly spawn the players on the base plate, but at random areas of the baseplate? JustinWe12 723 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

If you mean to randomly spawn them on different positions on the baseplate you can do

local xmin = --lowest x where the player can spawn to still be on the baseplate
local xmax = -- highest x where the player can spawn to still be on the baseplate
local yPosition = game.Workspace.BasePlate.Position.Y + Vector3.new(0,10,0) -- 10 studs above baseplate
local zmin = -- lowest z where the player can spawn to still be on the baseplate
local zmax = --highest z where the player can spawn to still be on the baseplate
character.Head.CFrame = CFrame.new(math.random(xmin, xmax), yPosition, math.random(zmin, zmax))
Ad

Answer this question