The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar


SetPosition will set the text shown on a touch button created by ContextActionService/BindAction|BindAction. Specifically, this sets the ImageLabel/Image property of the ImageLabel within the ImageButton that would be returned by ContextActionService/GetButton|GetButton. If no such bound action exists (e.g. nothing is returned by GetButton), this function does nothing and throws no error.

This function is part of a family of methods that customize the touch button of an action. Others in this family include ContextActionService/SetPosition|SetPosition and ContextActionService/SetTitle|SetTitle.


Name Type Default Description

The name of the action originally passed to BindAction

The value to which the Image property should be set


Return Type Summary

Code Samples

ContextActionService Touch Button

This code sample demonstrates binding an “Inspect” action to a touch button created automatically by ContextActionService. The button is customized using ContextActionService/SetImage|SetImage, ContextActionService/SetTitle|SetTitle, ContextActionService/SetDescription|SetDescription and ContextActionService/SetPosition|SetPosition. The button is further customized by using ContextActionService/GetButton|GetButton to get a reference to the ImageButton itself and tinting it green by setting ImageButton/ImageColor3.

Paste this code into a LocalScript placed within StarterPlayerScripts to test it. In Studio, be sure to toggle the touch device emulator in order for the button to actually be created.