Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script only going once? Your title should be specific! Describe your problem concisely.

Asked by 4 years ago

Help, I have this script that moves a car when it is anchored. It only moves once. How do I make it that it moves forever?

--something not to worry about

while true do
script.Parent.Parent:MoveTo(Vector3.new(1,0,0))
wait(0.1)
end

0
Ugh, I give up. I'll just use unanchored cars. Sure they like to crash a lot. but it's the only option I can do squidiskool 208 — 4y

4 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

You can do Vector3 + Vector3 like this:

while true do
script.Parent.Parent:MoveTo(script.Parent.Parent.PrimaryPart.CFrame.p + Vector3.new(1,0,0))
wait(0.1)
end

0
- Unable to cast CoordinateFrame to Vector3, line 2 squidiskool 208 — 4y
Ad
Log in to vote
0
Answered by
mmodh1alt -24
4 years ago

add a "while loop" it will make it go on forever

0
How? squidiskool 208 — 4y
0
I'm pretty sure there is already one? squidiskool 208 — 4y
0
I'm pretty sure there is already one? squidiskool 208 — 4y
0
lemme check something mmodh1alt -24 — 4y
Log in to vote
0
Answered by 4 years ago

Wait, it only goes to a specific location. How do I make it move on one axis?

0
This shouldn't be a answer, it should be a question but you can do Vector3.new(1, newValue, 1) for example MemezyDev 172 — 4y
0
I did that and it's still moving at that exact spot :( squidiskool 208 — 4y
Log in to vote
0
Answered by
MemezyDev 172
4 years ago

The issue is that in the while loop, you are always moving the car to the exact spot. To make it move one direction, you should change the x, y, or z axis, depending on what direction. Please accept my answer if it helps out!

0
But how? squidiskool 208 — 4y

Answer this question