Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make a model move while it is anchored?

How do i make this model move while it is anchored?

And i want the rocket car to move the X axis while it is anchored...

I am very new to scripting, so i don't know what to do by myself. If you know how then tell me the script.

2 comments

0

why is the model anchored? Wouldn't it be much easier to just weld all the parts together and then make the rocket car move like a normal car? Also this is not a request site

0

If a part is anchored it (and any connect parts) will not move due to any physics. You can still change the CFrame directly. It sounds like you don't want it to be anchored.

2 answers

try

model:MoveTo(Vector3.new(X,Y,Z))

1 comment

0

That just moves the vehicle to the middle of the map.

You want to create variables first so your script will be easier to edit in the future. Lets say, we have a model which consists of three parts, each has a name of 'One', 'Two', 'Three' respectively.

So to set the variable you give it a name.

One = game.workspace.Rocket.One
Two = game.workspace.Rocket.Two
Three = game.workspace.Rocket.Three

You can change the 'Rocket' to the name of the model. As 'One', 'Two', 'Three' is parented by the model.

Now to make it move.

One.CFrame = One.CFrame + Vector3.new(0,5,0)
Two.CFrame = Two.CFrame + Vector3.new(0,5,0)
Three.CFrame = Three.CFrame + Vector3.new(0,5,0)

The script above makes the parts move up by 5 studs on the y axis of the parts as the number '5' is on the y axis(x, y, z). But the script above doesn't make it 'animate' all it will do is teleport. To make it have a motion, you can make use of loops.

I am going to make use of the while true do loop. Here's how.

while true do
One.CFrame = One.CFrame + Vector3.new(0,0.1,0)
Two.CFrame = Two.CFrame + Vector3.new(0,0.1,0)
Three.CFrame = Three.CFrame + Vector3.new(0,0.1,0)
wait(0.1)
end

As you can see, I changed the number '5' to '0.1'. The parts will move up 0.1 studs every 0.1 seconds to sort of give it an 'animation'. Make sure to add a wait when using loops else if it might crash Studio.

This method is rather quite tedious if you have many parts. There are way more efficient and easier methods out there but this seems to be the easier to understand for beginners, well at least for me :). Hit me up if you still need more explaining. Either through ROBLOX messages or Discord :) FadedJayden#7171

4 comments

0

If anyone feels this answer should be taken down. Please tell me, I would kindly do so.

0

You should definitely be using local variables. They're more efficient.

0

Yeah, but my vehicle has MANY parts.

0

41 parts, to be exact.

This discussion is preserved as it was. New answers, comments, and votes are closed.