Is there a way to check if something is already binded with contextactionservice?

Probably going to change this later but right now i have a loop detecting if theres a current part, and if there is ill bind a placement action to place the part on m1

coroutine.resume(coroutine.create(function()
	while wait() do
		if CurrentPart then
			if not IsPlaceBinded then ContextActionService:BindAction("PlacePart", Binds, false, Enum.UserInputType.MouseButton1); IsPlaceBinded = true end
		else
			if IsPlaceBinded then ContextActionService:UnbindAction("PlacePart"); IsPlaceBinded = false end
		end
	end
end))

as of right now im using variables to define if the bind is binded or not and binding / unbinding based on that

so im wondering if there another way to do this / check if theres already a action binded

1 Like

Yes, there is a method called ContextActionService.GetBoundActionInfo that returns an empty table if there is no action bound with given name.

1 Like

You can use GetAllBoundActionInfo().

Here is a code that could be used:

local function isBound(lookingForName)
    if game:GetService("ContextActionService"):GetAllBoundActionInfo()[lookingForName] then
        return true
    else
        return false
    end
end
4 Likes