I was originally using Vector3, but CFrame gives me more capabilities. Here is my code, but how do i make everything the same with the only difference be using CFrame instead of Vector3.
script.Parent.MouseClick:Connect(function(player) player.leaderstats.Power.Value = player.leaderstats.Power.Value + 2 local character = player.Character local part = script.Parent.Parent.Parent part:MoveTo(Vector3.new(-136.224, -74.013, -484.131)) wait(30) part:MoveTo(Vector3.new(-136.224, -69.682, -484.131)) end)
TYSM
If you want to change the CFrame
of a part, simply change it's CFrame
property.
part.CFrame = CFrame.new(x , y , z)
If you want to change the CFrame
of a model, use the method SetPrimaryPartCFrame
.
model:SetPrimaryPartCFrame(CFrame.new(x , y , x))
As the name implies, the model needs a primary part in order to work.
What you're doing right now is calling a function called MoveTo()
which is a method of Model
that behaves the same way as SetPrimaryPartCFrame
but uses a Vector3
instead to position.
By the way, you should also consider reading up on the differences betweenCFrame
s and Vector3
s. There are use cases for both of these data types and CFrame
s shouldn't simply be considered a better version or be all end all of Vector3
s.