How can I keep repeating "plrpos = plrpos + Vector2.new(0.05, 0)" while the W key is down and then stop when the W key is up? I have this code, it works but how can I make it stop when W is up.
game:GetService("UserInputService").InputBegan:connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
if input.UserInputState == Enum.UserInputState.Begin then
repeat
wait()
plrpos = plrpos + Vector2.new(0.05, 0)
until ???--What can I do here to loop this until the player stops pressing the W key
end
end
end
end)
