#Delete pad mouvement

1 messages · Page 1 of 1 (latest)

sweet flame
#

Can some-one help me for disable the mouvement i want a game only on Gui not character. I do a script but only jump delete and not the character and the walk pad on phone.
Script : local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer

local function disableControls(character)
local humanoid = character:WaitForChild("Humanoid")

-- Bloquer les actions
local function blockInputs(actionName, inputState, inputObject)
    return Enum.ContextActionResult.Sink
end

local actionsToBlock = {
    "moveForward",
    "moveBackward",
    "moveLeft",
    "moveRight",
    "jump"
}

for _, actionName in ipairs(actionsToBlock) do
    ContextActionService:BindAction(actionName, blockInputs, false,
        Enum.UserInputType.Keyboard,
        Enum.UserInputType.Gamepad1,
        Enum.UserInputType.Gamepad2,
        Enum.UserInputType.Gamepad3,
        Enum.UserInputType.Gamepad4,
        Enum.UserInputType.Touch
    )
end

-- Désactiver joystick tactile "Move"
ContextActionService:UnbindAction("Move")

-- Désactiver déplacement et saut
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0

-- Forcer la désactivation du joystick tactile si sur mobile
if UserInputService.TouchEnabled then
    UserInputService.OverrideGamepadEmulation = true -- désactive joystick tactile natif
end

end

if player.Character then
disableControls(player.Character)
end

player.CharacterAdded:Connect(function(character)
disableControls(character)
end)