I’ve been trying to position my mobile button so that it is positioned the same in every device. Unfortunately this task proved difficulty to me and I want to know if there are any easier way to do this?
The script I’ve been trying to position the mobile button is from StarterCharacterScript btw
Could you provide the script? And for the position to be the same (relative to the screen’s size and dimensions) it would have to be scaled, offset is basically the distance from the anchor point.
local dashMobileButton
local mobileButtonPosition = UDim2.new(0.450, 0, 0.350, 0)
-- code
if dashMobileButton then
dashMobileButton.Position = mobileButtonPosition
end
there is no error, and also if i ut it on the starteplayerscript it would error as the script is specifically designed to apply to the player’s character
What part of the positioning is wrong? Can you provide some images so we can get an understanding of the problem? Are you trying to position the button in the centre of the screen or smthn
sorry been a long night miss read the last part of that
you can position this a few ways and try to get it about the same its frustrating at time
you can use viewport size to get the exact pixels of the device and do an offset from that of say set amount or percentage of the pixels
you can also set the anchor points on the button to 1 then subtract from there if you are trying to align it based on the right bottom side of the screen using scale
and on ui you can get the absolute size also doing some math to get the percent say something like X * .10 for 10 percent of the actual size
The location of the script shouldn’t matter. The script never uses script.Parent. Maybe there was something wrong with your script? Can you show the code that you tried to use?