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

why wont the player controls enable again?

Asked by 8 years ago

so ya... player controls..

function removeControl()
    local PressedKeys = game:GetService("UserInputService"):GetKeysPressed()
    repeat wait() until not next(PressedKeys) -- This should work! :D
    local ctx = game:GetService("ContextActionService")
    for actionName,control in pairs(ctx:GetAllBoundActionInfo()) do
        ctx:UnbindAction(actionName)
    end
end 

function replaceControl()
    local ctx = game:GetService("ContextActionService")
    for actionName,control in pairs(ctx:GetAllBoundActionInfo()) do
        ctx:BindAction(actionName)
    end
end

Answer this question