How can I move only the Y and Z position values, and leave the X the same?
Example:
local part = game.Workspace.Part
part.Position.XValue = 1
part.Position.YValue = 5
part.Position.ZValue = 1
How can I move only the Y and Z position values, and leave the X the same?
Example:
local part = game.Workspace.Part
part.Position.XValue = 1
part.Position.YValue = 5
part.Position.ZValue = 1
you can use vector3.new(x,y,z)
part.Position = part.Position + Vector3.new(0,5,1)
Use Vector3.new(), it makes a value with 3 vectors.
local part = game.Workspace.Part
local x = 1
local y = 5 --change to whatever you want
local z = 1 --change to whatever you want
part.Position = Vector3.new(x, y, z)
If you want to repeatedly move in random directions, try this:
local part = game.Workspace.Part
while true do
local x = 1
local y = math.random(1, 10) --change to whatever you want
local z = math.random(1, 10) --change to whatever you want
part.Position = Vector3.new(x, y, z)
wait(1)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.