ContextActionService question

Hello,

I have a question regarding the ContextActionService. When using BindAction to bind a function for a player, does it only bind the action for that specific player, or does it affect all players?

Scenario:

Let’s say I use ContextActionService:BindAction to bind a function with a specific string name for one player. If another player also binds an action with the same string name, and then I call UnbindAction, will it only unbind the action for that player or for all players since they share the same action name?

Here’s a script example:

function bindEquip(onEquipFunction, keycode)
    
    local heldGun = false
    
    local function onEquip()
        services.ContextActionService:BindAction("equip", onEquipFunction, false, keycode)
    end
    
    local function onUnquip()
        services.ContextActionService:UnbindAction("equip", onEquipFunction, false, keycode)
    end
    
end

return module

ContextActionService can only be called from a local script (or a module script required by a local script), so it will only bind and unbind actions for the local player it’s being called from.

aright, I’m getting into server and client actions, and for me it’s hard to understand because everything has to be named something new.

Thanks for your reply.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.