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

How to make sure Vector3 gets updated all the time?

Asked by 4 years ago

Hi! I'm currently trying to make a tram with brake and power pedals, operated by hotkeys. I want it to resemble a slider, but using just hotkeys for making the power/brakes stronger or weaker.

I want to make it so Vector3 (X axis to be exact) gets updated all the time - currently it only updates it once it executes it the first time.

while wait() do --script.Parent.Value > 0
    local force = 5000+(250*script.Parent.Value)
    script.Parent.Parent.Parent.Parent.Bogies.Front.Main.VectorForce.Force = Vector3.new(force,0,0) --see comment below
end

-- '0' should stay the same but also got no idea how to keep them the same, so for now, I'm just leaving them at 0. If you feel like explaining this too, go ahead, but it's not that needed.

Thanks in advance!

0
This code is bad and laggy. Use the Changed event if this should be based on script.Parent.Value changing. wait() does not belong in the conditional part as you are not using its return. So swap wait() with true and put the wait() in the loop body programmerHere 371 — 4y
0
It's more for experimental reasons for now, I'd do that all once the Vector3 issue is dealt with. Ralfotr 2 — 4y
0
"I want to make it so Vector3 (X axis to be exact) gets updated all the time - currently it only updates it once it executes it the first time." It needs to be executed to update so what are you asking for? programmerHere 371 — 4y

Answer this question