Value isnt changing in while true loop, how to fix?

Alright, to start off the blue box completely works. I have tested it by changing the angle value manually. The problem is that it doesn’t change the angle while rotating == true.

This is also running under a RenderStepped in RunService

1 Like

The CFrame is not in the while loop meaning it won’t update the angle

The loop never begins when the code is executed.

Put the while loop inside InputBegan

1 Like

The CFrame does work, its the value thats not changing.

You haven’t actually got a number in the wait(). Try that

When there isnt a number it does the smallest value, a tick.
and even if that was the case, ive already tested wait times.

So I’m very dumb, I included the Angle = 0 in the Render loop. So basically it was just reseting the value the whole time. My bad guys

3 Likes

The CFrame stored at the beginning of the script will only save with the original (whatever is set as the default value) value of the angle variable, the script won’t automatically update the CFrame whenever the variable changes.

@thomaspemby1 is right that you need to add the CFrame code inside of the while loop.

@DrKittyWaffles is also right, when the script first initializes, the rotating variable is by default, nil, so when the interpreter gets to that line, it won’t run the loop.

1 Like