My goal is to disable the all characters input for a small scene. The reason the walkspeed cannot be set to 0 is because the character will be moving/jumping during that cutscene.
for _, controller in pairs(game:GetService("ControllerService"):GetChildren()) do
controller.Parent = nil
end
The first function does not seem to work. The problem with the second one is that the character moves the direction you were heading after it’s enabled again. So the character would move that direction when enabled until another userinput was fired like pressing w again.
You can also change their player’s movement mode from UserChoice to Scriptable. On wiki as DevComputerMovementMode and DevTouchMovementMode. This might be slightly more useful because it can be set from the server as well and it makes sense since it is Scriptable.
These solutions will work, but I thought I’d add an easy way to do this if you’re using the default ControlScript. First you’ll want to copy the default ControlScript from a player and put it into PlayerScripts. It contains the MasterControl ModuleScript, which you can require to access some functions for controlling input to the character.
local player = game.Players.LocalPlayer
local masterControl = require(player.PlayerScripts:WaitForChild("ControlScript"):WaitForChild("MasterControl"))
masterControl:Disable()
wait(3)
masterControl:Enable()
print("voila!")
I would argue this way isn’t easier, it just relies on scripts existing which may not always exist unless you fork the default scripts, which you shouldn’t do.
@buildthomas’ code works fine, and doesn’t rely on any other scripts existing.
How would I also disable mouse input? Been trying to set up an animated cutscene thing but I can’t get it to work properly without disabling the player’s mouse input so they can’t move the camera while the cutscene (animation) is playing
Maybe set the camera to “Fixed” or “Scriptable”?
If it NEEDS the Humanoid’s “Custom” camera type, maybe you should rewrite the cutscene system you use to fit the types mentioned.
In Fixed, the mouse works, but the camera is immovable.
In Scriptable, the mouse also works, but the camera is immovable to all except Scripts.