#ContextActionService button for mobile scaling

1 messages · Page 1 of 1 (latest)

atomic sail
#

How can I make it so the button for an iPhone and iPad are close and not too far or different in size?

supple mossBOT
#

studio** You are now Level 5! **studio

late prawn
#

you got a code that scales it?

#

@atomic sail

atomic sail
#

when i tried to test, the size and the position is different on an iphone and ipad by a bit

late prawn
#

i think the issue is ur pos and size in ur CAS, the mobile button setup are defined using absolute pixel values (UDim2.new(0, 65, 0, 65) for size and UDim2.new(1, -70, 0, 10) for position

#

absolute values dont scale well across different screen sizes

atomic sail
#

so what can be done for that

atomic sail
late prawn
#

Try
the pos changing UDim2.new(1, -70, 0, 10) to UDim2.new(1, -0.1, 1, -0.15)

#

then the scale UDim2.new(0, 65, 0, 65) to UDim2.new(0.1, 0, 0.1, 0)

atomic sail
#

i dont understand how u did that tho?

late prawn
#

did it work?

atomic sail
#

i mean yea

#

its a lot better

late prawn
#

oh sweet

atomic sail
#

but how

#

u made the numbers smaller

late prawn
#

CAS:SetPosition("Crouch", UDim2.new(1, -0.1, 1, -0.15)) is 10% from right, 15% from bottom

#

then button.Size = UDim2.new(0.1, 0, 0.1, 0) is 10% of screen width and height

atomic sail
#

okay ill take notes of that, thank you so so much

late prawn
#

Yw make sure u add solved gooday

atomic sail
late prawn
#

the tag 😭

atomic sail
#

oh LOL

#

sorry

late prawn
#

All good 😭

atomic sail
#

and the size also make it a lot smaller

late prawn
#

🥀

atomic sail
late prawn
#

yes

atomic sail
#

hmm

#

not sure im trying to have 2, one for sprint and one for crouch but only sprint shows

late prawn
#

each one should have a unique action name

atomic sail
#

yes i have crouch as "Crouch" and sprint as "Sprint"

#

ah nvm i had the 3rd number as 1, i see both buttons now

#

but right now the buttons are like a centimere above the jump button on iphone 14, and like an inch above the jump in ipad