https://developer.roblox.com/en-us/articles/ContextActionService-Creating-Mobile-Buttons The link above is what I'm trying to understand. So this link doesn't really help me much and, I was wondering if I could get some help on this? I have a sample code provided below on what I would like to turn into a mobile button, a button only available on mobile or tablet that does the same thing as key pressed on PC. Is this something I add onto this or, a whole new LocalScript?
The code below is a LocalScript in StarterPack.
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local uis = game:GetService("UserInputService")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://182491423"
function OnKeyPressed(inputObject, gameProcessEvent)
if inputObject.KeyCode == Enum.KeyCode.Q then
humanoid:LoadAnimation(animation):Play()
end
end
uis.InputBegan:Connect(OnKeyPressed)
Thanks for the help in advance. I tried typing a test/sample code but, it didn't work because I don't how to organize and merge them together at this moment in time. I appreciate it!

1 comment
Oh shoot, thank you very much! I'm going to do some testing and more reading so I can learn more about it. Thanks for the links and help! I appreciate it.