#How to disable player input?
1 messages · Page 1 of 1 (latest)
Use "UserInputService"
local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")
local inputDisabled = false
local function disableControls()
ContextActionService:BindAction("DisableMovement", function() return Enum.ContextActionResult.Sink end, false, unpack(Enum.PlayerActions:GetEnumItems()))
end
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.E and not inputDisabled then
inputDisabled = true
disableControls()
end
end)
Put that in a local script in starterplayerscripts