How do I create mobile buttons?
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.
01 | local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() |
02 | local character = player.Character or player.CharacterAdded:Wait() |
03 | local humanoid = character:WaitForChild( "Humanoid" ) |
04 | local uis = game:GetService( "UserInputService" ) |
05 | local animation = Instance.new( "Animation" ) |
07 | function OnKeyPressed(inputObject, gameProcessEvent) |
08 | if inputObject.KeyCode = = Enum.KeyCode.Q then |
09 | humanoid:LoadAnimation(animation):Play() |
12 | 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!