In my basketball game, I have 4 moving jumpshot animations. Left, Right, Forward, Backward. How do I know which one to play? Thank you.
You can use userinput service. So if they for example press d that means they’re going right.
Yes, but what if they are pressing for example d and w
You can also add d and w if you want using “and.” If you want I can give you an example.
-- Put this is StarterCharacterScript
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(Input, Chatted)
if Chatted then
return
end
if Input.KeyCode == Enum.KeyCode.W then --You can change this to whatever keybind you want
--Play animation here or script
end
end)
Nope, that will work. thank you!
1 Like