Attempt to index nil with 'Size'

I don’t want this error to appear

ContextActionService:BindAction(ACTION_NAME, changeMode, true, Enum.KeyCode.LeftControl)
ContextActionService:SetTitle(ACTION_NAME, "Mode")

local button = ContextActionService:GetButton(ACTION_NAME)
button.Size = UDim2.fromOffset(75, 75)

It appears because button is nil. You should do a check to make sure the button exists before trying to edit properties in it

1 Like

This happens when you’re not on mobile. You should put something like “if button then” before trying to change its properties.

1 Like

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