I Need Some Help on moving an Object Via Script (As the Title Says) I tried this:
Local Part = game.Workspace:WaitForChild("Part")
Part.Position = (--X,Y,Z Numbers Here)
But Nothing Works, All Answers help.
I Need Some Help on moving an Object Via Script (As the Title Says) I tried this:
Local Part = game.Workspace:WaitForChild("Part")
Part.Position = (--X,Y,Z Numbers Here)
But Nothing Works, All Answers help.
Part.Position = Vector3.new(0,0,0)
You need to use Vector3
for this.
So to do this basically there some key concepts you need to understand
local Part = game.Workspace:WaitForChild("Part") -- we do this to find the part
Part.Position = Vector3.new(--x,y,z) vector3 is nearly always used in 3d positioning
but Vector2 or Udim2 is nearly always used in 2d position
Vector3 is 3 axis, X Y Z
Vector3.new(X,Y,Z) is how you can type the XYZ
Vector3.one for example is basically, the position, (1,1,1)
Vector3.new(1,1,1)
Vector2 uses 2 axis, you can see the name
X and Y
this is for GUI and positioning 2d elementz
Vector2.new(0,0) – position (0,0)
Part.Position = Vector3.new(
XPosition here,
YPosition here,
ZPosition here
)
Also, How would I Check the X Position In a if
Statement?
if Part.Position.X >= 1 then
Try doing that. You want to avoid doing ==
because positions aren’t always accurate.
Also How would I Make it always move, Do I do it like this:
while true do
--Move X Code
end
Yeah, but you need a task.wait()
so it doesn’t crash the game.
task.wait()
, or wait()
.
task.wait
if you don’t need the elapsed parameter.