How do I instantly set an objects X, Y, Z in roblox studio

309 views Asked by At

I would like to know how to set an objects x, y and z co-ordinates. could the solution also involve compatability for

math.random(0, 100)

thanks!

2

There are 2 answers

0
nezzled On BEST ANSWER
local x = math.random(0,100)
local y = math.random(0,100)
local z = math.random(0,100)

-- for debugging, if needed:
print(x, y, z)

local object = workspace.Part
object.Position = Vector3.new(x, y, z)
0
Piglet On

From https://developer.roblox.com/en-us/api-reference/property/BasePart/Position

local part = workspace.Part
part.Position = part.Position + Vector3.new(5, 20, 100)

https://developer.roblox.com/en-us/articles/positioning-objects