New Library: ActionContext

Howdy ya’ll, this post is to let you all know I released a handy little library recently: ActionContext. It’s an object-oriented way of using Roblox’s ContextActionService and alleviates a good amount of boilerplate code you’d find surrounding BindAction/UnbindAction calls. Rather than re-hash the documentation, I’ll just leave a quick bit of example code here.

local honkAction = {
    ActionName = "Honk",
    Inputs = { Enum.KeyCode.H, Enum.KeyCode.ButtonY },
    Handle = function (userInputState, inputObject)
        if userInputState == Enum.UserInputState.Begin then
            sound:Play()
        end
    end,
}
local actionContext = ActionContext.new({ honkAction })
-- Entering and leaving the car:
actionContext:Enter()
actionContext:Leave()
Continue reading “New Library: ActionContext”