how do i make my own crouching script with mobile support??? i tried searching for how but i cannot find anyothing or answers.
Make a ScreenGUI and name it like Mobile or something that you want and that will hold all your mobile buttons, now set it to disabled and when a player join check if the user input type is touch I believe and if it is, Enable the Mobile GUI to the player.
You can use ContextActionService:BindAction() for mobile/pc support.
For example:
local ContextActionService = game:GetService("ContextActionService")
ContextActionService:BindAction("Crouching", yourCrouchFunction, true, Enum.Keycode.C)
This will run the yourCrouchFunction when you touch the mobile button in mobile or press C. You can do the crouching by running and stopping a looped crouch animation, and while lowering the walk speed (optional)
For more detail on Context Action Service: ContextActionService | Documentation - Roblox Creator Hub
Use this Module
this is how you use it (local script)
local CAU = require(game:GetService("ReplicatedStorage").ContextActionUtility)
CAU:BindAction("Crouch",CrouchFunction,true)
CAU:SetTitle("Crouch","Click To Crouch")
-- Read the Api to learn how to make it an image instead of text or Hold to crouch
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.