Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to disable player input, even for controllers?

Asked by
Fifkee 2017 Community Moderator Moderation Voter
4 years ago

Hello, I'm making a turn-based game that should be compatible for controllers. I've ended up running into a small issue.

Although "ControlModule" works perfectly for keyboards, it doesn't really work well for controllers, as the player can still input using the control stick, which is the complete opposite of what I want. Furthermore, I tried making every KeyCode sink via ContextActionService. It works flawlessly with my keyboard, but again, my gamepad still prevails.

So, my question stands here. How do I disable player input for controllers and keyboards?

0
What type of input are you trying to disable? CrastificeDude612 71 — 4y
0
Movement (aka joystick). I'm not going to set WalkSpeed to 0, since some attacks will require walking. Fifkee 2017 — 4y
0
1. Run a game is studio (any game) 2. Swich to server 3. Copy StarerModule in StarterPlayer->StarterPlayerScripts. 4. Stop the game 5. Paste StarterModule back where it was. 6. Find gamepad module within. 7. Have Fun! (just remember that those scripts may be updated over time by roblox, and the ones you copied may not be compatible anymore) sleazel 1287 — 4y

1 answer

Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
4 years ago

You could simply do this

local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"

ContextActionService:BindAction(
    FREEZE_ACTION,
    function() return Enum.ContextActionResult.Sink end,
    false,
    unpack(Enum.PlayerActions:GetEnumItems())
)

and to unfreeze do this

ContextActionService:UnbindAction(FREEZE_ACTION)
0
That's what I meant by trying to sink it. It doesn't work at all. Fifkee 2017 — 4y
0
Well then just set walk speed and jump power to 0 i guess? Prestory 1395 — 4y
Ad

Answer this question