How do i make the SetPrimaryPartCFrame move parts by a number and not put it in the exact world position any help would be great!
1 Like
local MoveDirection = Vector3.new(0, 0, -5)
Model:PivotTo(Model:GetPivot() * CFrame.new(MoveDirection))
Moves the model 5 studs forward in world space.
Use PivotTo because SetPrimaryPartCFrame was superseded by it.
You’d use the instance method TranslateBy()
that can be called on model instances, it accepts a Vector3 value as its argument and translates the model’s position by that value, take the following for example.
local model = Instance.new("Model")
local part = Instance.new("Part")
part.Parent = model
local modelPosition = model:GetPivot()
print(modelPosition.Position) --0, 0, 0
local vector = Vector3.new(1, 1, 1) --Translate model by 1 unit in the positive direction of all axis (x, y and z).
model:TranslateBy(vector)
modelPosition = model:GetPivot()
print(modelPosition.Position) --1, 1, 1
https://developer.roblox.com/en-us/api-reference/function/Model/TranslateBy