Type Index Pages
- BillboardGui
- Frame
- Hint
- ImageButton
- ImageLabel
- PlayerGui
- ScreenGui
- ScrollingFrame
- StarterGui
- SurfaceGui
- TextBox
- TextButton
- TextLabel
- UIAspectRatioConstraint
- UIGradient
- UIGridLayout
- UIListLayout
- UIPadding
- UIPageLayout
- UIScale
- UISizeConstraint
- UITableLayout
- UITextSizeConstraint
- VideoFrame
- ViewportFrame
- ChangeHistoryService
- CoreGui
- DataModelSession
- DockWidgetPluginGui
- MultipleDocumentInterfaceInstance
- Plugin
- PluginAction
- PluginGui
- PluginGuiService
- PluginManager
- PluginMenu
- PluginMouse
- PluginToolbar
- PluginToolbarButton
- QWidgetPluginGui
- Selection
- StandalonePluginScripts
- StatsItem
- StudioService
- StudioTheme
No results found!
-
Instance
- GameSettings
- DebugSettings
- BodyMover
- WeldConstraint
- HttpRbxApiService
- NotificationService
- Translator
- Lighting
- Beam
- GuiService
- UserInputService
- Studio
- Plugin
- HttpService
- Mouse
- BindableEvent
- RunService
- Pages
- Humanoid
- TestService
- PathfindingService
- Chat
- NetworkPeer
- Feature
- CharacterAppearance
- Constraint
- NetworkReplicator
- JointInstance
- Light
- BasePlayerGui
- AnalyticsService
- NetworkMarker
- BinaryStringValue
- FlyweightService
- Geometry
- LoginService
- InstancePacketCache
- ThirdPartyUserService
- TouchInputService
- RuntimeScriptService
- GuidRegistryService
- PartOperationAsset
- DialogChoice
- PhysicsService
- AdService
- TextService
- MarketplaceService
- TeleportService
- Accoutrement
- GamePassService
- AssetService
- InsertService
- PointsService
- ChangeHistoryService
- ServerScriptService
- JointsService
- LogService
- InputObject
- Toolbar
- LuaSettings
- RenderSettings
- AnimationTrack
- PhysicsSettings
- NetworkSettings
- CFrameValue
- Animation
- Color3Value
- BoolValue
- BrickColorValue
- Vector3Value
- AnimationController
- BindableFunction
- Button
- Trail
- LocalizationTable
- LocalizationService
- DebuggerBreakpoint
- DebuggerWatch
- ScriptDebugger
- Animator
- Attachment
- RemoteFunction
- RemoteEvent
- PluginManager
- Camera
- Stats
- Sky
- StarterPlayer
- Dragger
- TerrainRegion
- Path
- TextFilterResult
- Dialog
- StatsItem
- GoogleAnalyticsConfiguration
- ScriptContext
- ControllerService
- CacheableContentProvider
- ReflectionMetadataClasses
- ReflectionMetadataEnums
- DebuggerManager
- GuiBase
- UIBase
- LuaSourceContainer
- GuiItem
- DataModelMesh
- ServiceProvider
- ReflectionMetadataItem
- PostEffect
- PhysicsPacketCache
- TouchTransmitter
- RobloxReplicatedStorage
- Visit
- LuaWebService
- ScriptService
- FlagStandService
- VirtualUser
- SpawnerService
- TimerService
- CookiesService
- Team
- GroupService
- StarterGear
- Message
- PlayerScripts
- Configuration
- ContentProvider
- CollectionService
- Debris
- ReplicatedFirst
- ServerStorage
- ReplicatedStorage
- Folder
- TweenService
- Players
- ContextActionService
- StarterPlayerScripts
- SoundService
- KeyframeSequenceProvider
- VRService
- PluginGuiService
- Player
- Teams
- Pose
- Keyframe
- KeyframeSequence
- IntConstrainedValue
- DoubleConstrainedValue
- ForceField
- RayValue
- Fire
- Smoke
- Sparkles
- ParticleEmitter
- IntValue
- StringValue
- NumberValue
- Explosion
- ObjectValue
- SoundGroup
- UserGameSettings
- ClickDetector
- Sound
- Selection
- BadgeService
- TaskScheduler
- GlobalDataStore
- DataStoreService
- CustomEvent
- CustomEventReceiver
- VirtualInputManager
- FunctionalTest
- TweenBase
- SoundEffect
- ReflectionMetadataEvents
- ClusterPacketCache
- PVInstance
- FaceInstance
- Controller
- ReflectionMetadataCallbacks
- ReflectionMetadataFunctions
- ReflectionMetadataYieldFunctions
- ReflectionMetadataProperties
- ReflectionMetadata
- AdvancedDragger
- HapticService
- FriendService
- GamepadService
No Result Found !!!
AnchorPoint
This property determines a GuiObject|GUI
, which is relative to its absolute size. The origin point determines from where the element is positioned (through GuiObject/Position
) and from which the rendered GuiObject/Size
expands.
A good rule of thumb for this property: if the GUI in question is aligned to the left, the X value should be 0. If horizontally centered, set to 0.5. Finally, if the element is aligned to the right, the X value ought to be 1. Similarly, set the Y value to 0, 0.5, and 1 for top, middle, and bottom for Y alignment.
To understand how AnchorPoint works, try creating a Frame
with Frame/Position
set to DataType/UDim2|UDim2.new(0.5, 0, 0.5, 0)
(this will set the Frame in the center of its parent object). If you were to change Frame/Size
, you would notice that the Frame will expand to the right and downward. The very center of the frame would also not be at the exact center of the parent object. However, if you were to set the AnchorPoint to (0.5, 0.5)
, the Frame would expand in all directions and the center of the frame would indeed be at the parent object’s center.
Code Samples
AnchorPoint Demo
This code sample moves a UI element to different sides of the parent element. It starts at the top-left and ends at the bottom-right. Paste into a LocalScript in a Frame, within a ScreenGui.
local guiObject = script.Parent while true do -- Top-left guiObject.AnchorPoint = Vector2.new(0, 0) guiObject.Position = UDim2.new(0, 0, 0, 0) wait(1) -- Top guiObject.AnchorPoint = Vector2.new(0.5, 0) guiObject.Position = UDim2.new(0.5, 0, 0, 0) wait(1) -- Top-right guiObject.AnchorPoint = Vector2.new(1, 0) guiObject.Position = UDim2.new(1, 0, 0, 0) wait(1) -- Left guiObject.AnchorPoint = Vector2.new(0, 0.5) guiObject.Position = UDim2.new(0, 0, 0.5, 0) wait(1) -- Dead center guiObject.AnchorPoint = Vector2.new(0.5, 0.5) guiObject.Position = UDim2.new(0.5, 0, 0.5, 0) wait(1) -- Right guiObject.AnchorPoint = Vector2.new(1, 0.5) guiObject.Position = UDim2.new(1, 0, 0.5, 0) wait(1) -- Bottom-left guiObject.AnchorPoint = Vector2.new(0, 1) guiObject.Position = UDim2.new(0, 0, 1, 0) wait(1) -- Bottom guiObject.AnchorPoint = Vector2.new(0.5, 1) guiObject.Position = UDim2.new(0.5, 0, 1, 0) wait(1) -- Bottom-right guiObject.AnchorPoint = Vector2.new(1, 1) guiObject.Position = UDim2.new(1, 0, 1, 0) wait(1) end
How this site use cookies
This Platform uses cookies to offer you a better experience, to personalize content, to provide social media features and to analyse the traffic on our site. For further information, including information on how to prevent or manage the use of cookies on this Platform, please refer to our Privacy and Cookie Policy.