So, I found a perfect crawl script but it turns out it only supports PC. I wanted to make it compatible for consoles and phones/tablets. So I took a try at making it for consoles, I tried the LT button and tested it out, it obviously did not work. So I looked for any solutions on here and didn’t find any. I highly doubt I was going to be able to make it for mobile devices, so can anyone help me get this script compatible for consoles and mobile devices?
--// Configuration
local keybind = "C"
local Keybind = "ButtonLT"
local animationId = 13533049168 --> Replace the number with your animation ID!
--// Variables
local UserInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = 'rbxassetid://' .. animationId
local animationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(animation)
animationTrack.Priority = Enum.AnimationPriority.Action
local crouching = false
--// Functions
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode[keybind] then
if crouching then
humanoid.WalkSpeed = 16
crouching = false
animationTrack:Stop()
character.HumanoidRootPart.CanCollide = true
else
humanoid.WalkSpeed = 7
crouching = true
animationTrack:Play()
character.HumanoidRootPart.CanCollide = false
end
end
end)