Im trying to add mobile support to my game as I found out a lot of ROBLOX’s playbase is just mobile users. And currently I have made some aspects for the GUI but I am still quite confused with how I will do it.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local UIS = game:GetService("UserInputService")
local MobileUI = Player.PlayerGui.MobileGUI
local core = game.ReplicatedStorage:WaitForChild("CustomMovement");
local utility = core:WaitForChild("Utility");
local uisBinds = require(utility:WaitForChild("UserInputBind"));
local moveSet = require(core:WaitForChild("MoveSet")).new(game.Players.LocalPlayer);
--
local function slowFall(actionName, userInputState, input)
moveSet:setSlowFall(userInputState == Enum.UserInputState.Begin)
return Enum.ContextActionResult.Pass;
end
local function dive(actionName, userInputState, input)
if (userInputState == Enum.UserInputState.Begin) then
moveSet:dive();
end
return Enum.ContextActionResult.Pass;
end
local function crouchHold(actionName, userInputState, input)
moveSet:setCrouch(userInputState == Enum.UserInputState.Begin);
return Enum.ContextActionResult.Pass;
end
local function crouchToggle(actionName, userInputState, input)
if (userInputState == Enum.UserInputState.Begin) then
moveSet:setCrouch(not moveSet:isCrouching());
end
return Enum.ContextActionResult.Pass;
end
--
--moveSet.isLookingAt = false;
-- Why not use contextAction service? Doesn't play nicely with controllers
uisBinds:BindToInput("dive", dive, Enum.KeyCode.LeftShift, Enum.KeyCode.ButtonX);
uisBinds:BindToInput("slowFall", slowFall, Enum.KeyCode.Space, Enum.KeyCode.ButtonA);
uisBinds:BindToInput("crouchHold", crouchHold, Enum.KeyCode.ButtonL2, Enum.KeyCode.LeftControl);
--uisBinds:BindToInput("crouchToggle", crouchToggle, Enum.KeyCode.LeftControl);
UIS.JumpRequest:Connect(function()
moveSet:onJumpRequest();
end)
game:GetService("RunService"):BindToRenderStep("MoveSet", Enum.RenderPriority.Input.Value, function(dt)
moveSet:update(dt);
end)
if UIS.TouchEnabled then
MobileUI.Enabled = true
MobileUI.MobileFrame.Dive.MouseButton1Click:Connect(function()
end)
end
This is pretty vague. Mobile support depends on the game and I can’t tell what the game is based on this script. If you can play your game well on mobile, then it has mobile support.
Well, I understand it now. Adding mobile support for this type of game is going to be very difficult. Even the best setup for mobile support here would be challenging to play. This is why the game Parkour does not have mobile support, it’s too hard to make…
I don’t know. If you can make a simpler system dedicated for mobile players, or give them a slight advantage, it could be fine. However, the system you already have might be restricting the change to allow something like that.
You do have a point and I may consider adding some sort of mobile thing. Perhaps if the user is mobile it could put them in some sort of spectator thing. Like a flying ghost that could just see the rest to ensure the user isn’t that restricted from playing.
Suggesting it’s too hard, or providing a link to another game that doesn’t support mobile, is not very sound guidance. The majority of your customers are going to be using touch devices. And the smallest portion of your customers are going to be on PC. In web development we have a term called “mobile-first” design and this philosophy has served me well in game design. Think first of the tightest, smallest, and often the most challenging display and input from a handheld user, and the rest “flows upward” from there to the highest supported resolution.
My game Slither Simulator fully supports mobile, console, and PC controls, and there are many techniques involved. I suggest you see my post in the “Making the Character Fly” tutorial where I added mobile touch support where before it wasn’t working. You need to study the Api’s of UserContextService and to a lesser extend ContextActionService in order to write your own inputs that can target any user’s input device. If the built-in mobile Jump button isn’t serving your needs, you need to hide that and build your own.