How do i move the X coordinate (only) of the model via a script?
TweeningService I belive. That is what I was told.
local model = game.Workspace.Model
local modelcframe = model:GetPrimaryPartCFrame()
model:SetPrimaryPartCFrame(modelcframe.Position.X+5,modelcframe.Position.Y,modelcframe.Position.Z)
Sorry if this doesn’t work I typed it on phone
Edit: also don’t forget to add a primary part to the model in properties
Simple, set position to
Vector3.new(XPositionThatYouWant, Part.Position.Y, Part.Position.Z)
If you wanna smoothly move the part use tweenService, it doesn’t really change anything about what I said but gives a smooth transition to the position that you want.
You cannot move a single coordinate. Changing the value of X will result in the change of the whole model’s position.
You’ll have to have a Primary Part of the model.
Here is a code example.
local Model = workspace.Model --varies according to the location of the model.
local Position = Model.PrimaryPart.Position
local IncrementValue = 100
Position = Vector3.new(Position.X - IncrementValue , Position.Y, Position.Z)
Not only you can also you :MoveTo() and :SetPrimaryPartCFrame(). You can also use TweenService in case you want to make it smooth.
i know im late but SetPrimaryPartCFrame() is deprecated, and you’re supposed to use GetPivot() now.