Bugged but I don't know why?
Asked by
5 years ago Edited 5 years ago
Ok so I'm making a script where "A" rotates the character counter-clockwise and "D" clockwise, but there is a bug causes the player to wiggle extremely quickly.
03 | USI.InputBegan:connect( function (inputObject) |
04 | if player.Character then |
05 | while inputObject.KeyCode = = Enum.KeyCode.A do |
06 | root.CFrame = root.CFrame*CFrame.Angles(math.rad( 0 ), math.rad(turnSpeed), math.rad( 0 )) |
09 | while inputObject.KeyCode = = Enum.KeyCode.D do |
10 | root.CFrame = root.CFrame*CFrame.Angles(math.rad( 0 ), math.rad(-turnSpeed), math.rad( 0 )) |
16 | USI.InputEnded:connect( function (inputObject) |
17 | if player.Character then |
18 | while inputObject.KeyCode = = Enum.KeyCode.A do |
19 | root.CFrame = root.CFrame*CFrame.Angles(math.rad( 0 ), math.rad(-turnSpeed), math.rad( 0 )) |
22 | while inputObject.KeyCode = = Enum.KeyCode.D do |
23 | root.CFrame = root.CFrame*CFrame.Angles(math.rad( 0 ), math.rad(turnSpeed), math.rad( 0 )) |
Sometimes the person isn't wiggiling other times he goes really fast, and sometimes he moderitly. How can this be fixed?