Hello, I was trying to position a part randomly from a table, and I noticied my script only changes the first Axis. I think the commas that seperate the axis mess the table up, how do I store them properly?
Is there a way to do it for all the axis in my table?
local positions = {
6.93, 0.5, 33.16,
18.71, 0.5, 35.57,
-15.27, 0.5, 23.67
}
local part = script.Parent
function movePart()
part.Position = Vector3.new(positions[math.random(1,#positions)])
end
while true do
wait(1)
movePart()
end
If you want an explanation why it didn’t work: It didn’t work for you before because you didn’t make them a Vector3 value, so you have actually just chosen some number (for example 0.5) and you positioned it there, but Vector3 needs 3 arguments (X, Y, Z) so that’s why it didn‘t work. (I am bad at explaining sorry if you don’t understand that.)