Context Action Service Not Getting Buttons?

For some reason, when I use ContextAction:GetButton, it returns nil, even though I’ve made the button and I can see it parented in my player gui.

Here’s the code:

ContextAction:BindAction("PBrake", ContextToInput, true)
ContextAction:BindAction("Leave", ContextToInput, true) -- not getting the button for this one...

Then later on…

        do -- this one works
		local Button = ContextAction:GetButton("PBrake")
		Button.Position = UDim2.new(0.9, 0,0.5, 0)
		Button.Size = UDim2.new(0.1, 0,0.1, 0)
		Button.AnchorPoint = Vector2.new(0.5,0.5)
		Button.Parent = script.Parent
		
		local AspectRatio = Instance.new("UIAspectRatioConstraint", Button)
	end
	do -- The GetButton method returns nil on this one
		local Button = ContextAction:GetButton("Leave")
		Button.Position = UDim2.new(0.9, 0,0.35, 0)
		Button.Size = UDim2.new(0.1, 0,0.1, 0)
		Button.AnchorPoint = Vector2.new(0.5,0.5)
		Button.Parent = script.Parent
		
		local AspectRatio = Instance.new("UIAspectRatioConstraint", Button)
	end

I have no idea why this doesn’t work, but it doesn’t. There are a lot more bindings above this one in the script though. Here’s the full list.

        ContextAction:BindAction("Throttle", ContextToInput, true)
	ContextAction:BindAction("Brake", ContextToInput, true)
	ContextAction:BindAction("SteerLeft", ContextToInput, true)
	ContextAction:BindAction("SteerRight", ContextToInput, true)
	ContextAction:BindAction("ShiftUp", ContextToInput, true)
	ContextAction:BindAction("ShiftDown", ContextToInput, true)
	ContextAction:BindAction("PBrake", ContextToInput, true)
	ContextAction:BindAction("Leave", ContextToInput, true) -- not getting the button for this one...

Each of those have their own do … end script identical to the ones above. If you guys need the full scripts just DM me I’ll be happy to give them to you.

Edit: Even after I unbind the action, the button on my screen still doesn’t remove.

1 Like

Had the same issue in my game while attempting at creating an interactive vehicle entering/leaving script. Everything worked other than Leave. Perhaps it’s being used by Roblox? I’m not entirely sure, but renaming it fixed the issue on my part.

2 Likes

I’m doing the exact same thing - Did it happen to be A-Chassis? That might have something to do with it.
Edit: Sorry for the long delay, I was away from a computer for the past week.

Indeed, it was a modified A-Chassis version.

1 Like

Interesting, we’re in exactly the same situation. I’m curious to see what is causing this since it’s consistent with A Chassis.

I believe I saw somewhere that there’s a GetButton limit of 7, which would sum up your issue.

1 Like

I wonder why that would be :thinking:

Oh well, thanks for the feedback