So I am basically making my own control script for the roblox character, and I am having an issue in the keyboard input, what I am trying to do is when the player's "W" key goes down, make the player's characters torso go forward until the "W" key goes up. I am having trouble finding when the "W" key goes up, and I am pretty frustrated as roblox does not seem to have any method or function able to find when a key goes up. Here is the local control script so far:
local r = game:GetService("ReplicatedStorage"):WaitForChild("Control"); local uis = game:GetService("UserInputService"); local cas = game:GetService("ContextActionService"); uis.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.W then r:FireServer("W"); end end
When r (the remote event) fires the server the "W" string, the server script will make the character move forward according to the torso's lookVector. This works great, but it only moves forward one time when the w key is down. I am trying to get the character to continue moving forward while the w key is down, and halt movement when the w key goes up. Any help would be appreciated a lot. Thanks
Are you looking for InputEnded
???
Example:
game:GetService("UserInputService").InputEnded:connect(function(Input) if Input.KeyCode == Enum.KeyCode.W then --put ur stuff here end end)