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

Using the Velocity portion of a part?

Asked by 8 years ago

Hello, So I am using a velocity part of the peice to make it a convayor. I am using a script and want it so my item on top stops moving after 6.5 seconds. But for some reason the velocity never changes for -15. (Also is there anyway to get rid of that so it just says 15) And if you know of a way to shrink this or make it more efficent tell me. I also want it so the loop runs until the script is false and then stops running and turns back on when the script is turned to enabled.

while true do
script.Parent.Velocity = script.Parent.CFrame.lookVector *15
wait(6.5)
script.Parent.Velocity = Vector3.new(0,0,0)
wait(1.)
script.Disabled = true
end

Console has 0 errors

1 answer

Log in to vote
1
Answered by 8 years ago

Well basically you are not setting the velocity equal to 0. I have learned through scripting that most times you would add or multiply so maybe try this script.

while true do
script.Parent.Velocity = script.Parent.CFrame.lookVector *15
wait(6.5)
script.parent.Velocity + Vector3.new(0,0,0)
wait(0.1)
script.Disabled = true
end

Also take into consideration that you are making the script disabled.

while true do
script.Parent.Velocity = script.Parent.CFrame.lookVector *15
wait(6.5)
script.parent.Velocity + Vector3.new(0,0,0)
wait(0.1)
if script.Disabled = true then
    script.Disabled = true
else
    script.Disabled = false
end

If this last script doesn't work then just see if my original one works. if that one doesn't work either then I will try to keep helping you.

Ad

Answer this question