I cant trigger the animation in mobile?

So when i try to trigger it. it wont work.

here is the script: https://gyazo.com/5a600dcbf05fe6c930f415299c69d5c8

here when i try to trigger it: https://gyazo.com/16e9be3c0b5b95e59cb2b4e48ede3f1e

Have any ideas?

1 Like

So, your problem is your onButtonPress() function is not defined properly. You need to get rid of the UserInputService event since you are using ContextActionService. This is how it would look:

local function onButtonPress(name, state, obj)
    if canSlide and state == Enum.UserInputState.Begin then 
          --Just copy all the code that you put in the if 'input.KeyCode == keybind' code block
    end
end

Also, keep the ContextActionService definitions at the bottom. Please, next time, put your code in pastebin or your post so it is easier to copy and paste.

Can this work.

https://gyazo.com/4a83e04f19ec7d5eb0e4a2fff693dcba

Just a tip, to avoid code duplication just setup and external function and call if from both events.

It cant work. you can even see the script

can anyone tell me? the problem