local run = game:GetService("RunService").RenderStepped
local keyheldq = false
local keyhelde = false
function onKeyPressQ(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.Q then
keyheldq = true
while keyheldq do
torsorot = 0
local rot = 0
while torsorot < 100 do
torso.CFrame = CFrame.new(torso.Position) * CFrame.Angles(0, rot, 0)
rot = rot + .01
print(rot)
run:wait()
end
wait()
end
end
end
function onKeyReleaseQ(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.Q then
print("Stopped holding the Q!")
torsorot = 100
torso.CFrame = CFrame.new(torso.Position)
keyheldq = false
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPressQ)
game:GetService("UserInputService").InputEnded:connect(onKeyReleaseQ)
When the key Q is released, it doesn't stay at the Angle, it resets the angle to 0 again, and it doesn't stay,
I'm trying to make a character customization menu.
This is for character rotation as you might noticed.

1 comment
Try making the rotation variable go through the entire script. This will mean you won't have to redefine it every time you want to make a change etc.