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

How to disable a keyboard?

Asked by 8 years ago

For example: If a cut scene happens, I want the players keyboard to disable when it happens and when the cut scene is over, the keyboard is back working.

1 answer

Log in to vote
1
Answered by 8 years ago

Ways to do this.

Now there are 2 ways to do this. I will list them both. One, very simple. And the other fairly complex.

1. Making the player's walkspeed 0.

Now. This is a fairly simple way, isn't it? Yes. it is. no gimmicks, no jokes. All you have to do is make the player's walkspeed 0. But there are some cons to this which may make you want to consider the other choice.

Cons: The player can jump, Any other script which edits the player's walkspeed can edit this.

2. Disabling/Enabling the ControlScript.

Ok, so there is a script inside the Player called ControlScript. This script is basically how player's controls their character. If disabled or removed, the player loses all control.

But how do we do it?

local control = player:findFirstChild("ControlScript", true) -- set the bool recursive to true so it looks through all of its children
control.Disabled = true 

This will disable the control script, rendering the player's ability to move useless. But remember, you have to make Disabled false after the cutscene is done, or the player will be stuck there, forever.

0
Ok Thanks! zekrom6810 15 — 8y
Ad

Answer this question