i think i had the same issue as you when i was a noob making my own walk script.
the only difference is that i used contextActionService while you used userInputService
the reason why your code is not working is because you’ve told the game “if input ended, stop the character”
which just means you can be pressing any of the keys (wasd) and if you lift one key up your entire character stops moving
this was the exact same problem i had when i was making my own custom walk script
i ended up using roblox’s method as it was the most simple but i didnt really realize i was using roblox’s method of making the character move until i could read code well enough that i decided to challenge myself to read roblox’s walkScript which was placed in the playerModule to see if i could understand what was written
so the main reason why your code isnt working to sum it up is because you’ve told the script to stop moving the character if ANY KEYS IS LIFTED
so kind of like this
you: “press W and expects the character to move forward”
game: move character forward
you: “lift M key and expects the character to keep moving forward”
game: input ended event triggered, blindly stop the character
you: “im still holding the W key. I expected the character to keep moving forward”
if you put some if statements on your inputEnded event, you should be fine
and also you should use runService to update player:Move
local w,a,s,d = 0,0,0,0
local runService = game:GetService("RunService")
runService:BindToRenderStep(function() --do not write bind to render step like this, you'll have to fill in a couple of arugments. Im just simplifying it
local moveDirection = Vector3.new(d - a, 0, s - w)
player:Move(moveDirection, true)
end)
you need run service to update the player’s movement because what will happen if you dont is that if you hold down W then turn the camera to the left, your character wont be walking where the camera is looking at
and also the documentation for bindToRenderStep because i’ve simplified the process of writing it in the code above RunService | Roblox Creator Documentation
this documentation will show you the proper way
i just realized you look like your making a movement script for a 2d game and you might not actually need runService
basically to sum this up, the line of problem is this 3 lines of code
uis.InputEnded:Connect(function(input)
player:Move(Vector3.new(0, 0, 0), true) --put your if statements and your fine to go
end)
code improvement suggestion: you dont need to change the state of the humanoid
you can just do “humanoid.Jump = true”
https://create.roblox.com/docs/reference/engine/classes/Humanoid#Jump
just a tiny quality of life change that improves the understandability of the logic in your code unless making the humanoid jump isnt what you want
any questions, just ask