I’m trying to make it so that when a player is ragdolled, none of the user inputs work. Any answers would be appreciated, thanks.
When they press a key, check if they’re ragdolled.
You can’t disable UserInputService, however ContextActionService is a lot more flexible with handling inputs. This is a snippet of a script that would block specified input, assuming everything was using ContextActionService like the default character scripts are:
local ContextActionService = game:GetService("ContextActionService")
-- table for blocked actions, you can add some here if need be
-- this should only be filled with Enum.PlayerActions, Enum.KeyCode, and/or Enum.UserInputType
local blockedInputs = {}
-- this will add all character actions (Forward, Backward, etc) to the blocked actions
for _, playerAction in pairs(Enum.PlayerActions:GetEnumItems()) do
table.insert(blockedInputs, playerAction)
end
-- block input
ContextActionService:BindActionAtPriority(
-- bind name
"blockInputs",
-- bind function for keypresses and actions
function()
-- Sink will make all actions stop here and not continue to other context actions
return Enum.ContextActionResult.Sink
end,
-- should we create a touch button?
false,
-- priority level. it should be higher than your other actions
1e6,
-- inputs for the action, which for the block input we will just unpack the table above
unpack(blockedInputs)
)
and if you needed to unblock input at any point, you would call this function after:
ContextActionService:UnbindAction("blockInputs")
I hope this helps!