I'm trying use the UserInputService and a While Loop to detect w being held down, so I get smooth movement of my Part. However as soon as I let go of w it just keeps moving on its own and moves faster each time I press w again. How can I detect w being held down?
Char = workspace.Char
UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(Input)
while Input.KeyCode == Enum.KeyCode.W do
Char.CFrame = Char.CFrame * CFrame.new(0,0.1,0)
wait()
end
end)

2 comments
http://wiki.roblox.com/index.php?title=API:Class/UserInputService/GetKeysPressed
Or checking to see if a particular key is pressed: http://wiki.roblox.com/index.php?title=API:Class/UserInputService/IsKeyDown