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

Variable changes for no reason? [SOLVED]

Asked by 6 years ago
Edited 6 years ago

(Edited, to appear calmer; clearly is unwanted so apologies)

char.Humanoid.Jumping:Connect(function()
            local Vel = humroot.Velocity
            print(Vel)
            bodyForce.Force = Vector3.new()
            repeat
                humroot.Velocity = Vector3.new(humroot.Velocity.X, humroot.Velocity.Y, Vel.Z)
                _S.RunService.RenderStepped:Wait()
                print(Vel)
            until char.Humanoid:GetState() ~= Enum.HumanoidStateType.Jumping or Enum.HumanoidStateType.Freefall
            bodyForce.Force = Vector3.new(0, -10, 0)
        end)

For some reason here, Vel will change even though there is nothing to change it. This renders the portion of the script useless.

So....

Workaround?

(EDIT: I have legit no idea why I'm getting downvoted... maybe just leave a comment to let me know why? If it's per effort, I have taken effort into attempting to fix.)

(EDIT EDIT: yurray a comment halped me figure it out

Apologies for the prior inconveniences - I had forgotten the guideline of noting what you're trying to accomplish.)

Edit: Solved it; apparently it was just that the loop was short. Solution:

until char.Humanoid:GetState() == Enum.HumanoidStateType.Landed

can't believe i was so dumb that i didn't pay enough attention the fact that it would fire output only four times

0
What're you trying to do? TheeDeathCaster 2368 — 6y
0
I'm making a game where you like, ride a train into the glitchlands, and this is just supposed to help prevent the player from always flying backwards when they jump. sweetkid01 176 — 6y
0
jeez how come has nobody answered this yet sweetkid01 176 — 6y

Answer this question