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

Not Changing Velocity Value. Why?

Asked by 7 years ago

Hello. I'm New On Scripting. script.Parent.Velocity = Vector3.new(5,0,0) Thats A My Script. But Not Working

0
Thanks for Helping :) DhMrfuun 1 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Your script:

script.Parent.Velocity = Vector3.new(5,0,0)

The reason for this is basically to keep doing the movement on the object, this means it will continue instead of one stop, this will keep doing it in a loop so that it keeps moving.

while wait() do
    script.Parent.Velocity = Vector3.new(5,0,0)
end
0
Why did you give me a -1 reputation, I explained what it is, I just forgot about the engine stuff, I'm trying to make it easier. StarMarine614Classic 14 — 7y
Ad
Log in to vote
1
Answered by 7 years ago

Unless the part is Anchored, the Roblox physics engine will constantly update the Velocity property of all simulated parts. When your code runs, it will set the Velocity of script.Parent to 5, 0, 0 for a split-second, then the physics engine takes over and the part will simulate normally. The result of this is like 'punching' the part. If you want to create a stable velocity (eg. to make the part 'fly' at a particular speed), you will need to insert a BodyVelocity into the part.

Answer this question