Looking at the place button. In the mobile it’s inside the jump button for the mobile, but well above the jump button for tablet. I’ve tried using both the scale and offset, but nothing actually ‘scales’ the buttons position properly. If I want the button to be above the jump button, and have the same ‘scale’ position for both mobile and tablet, without getting this massive gap difference
You can find how the actual position inside the Roblox scripts packaged with your client version. Note however that these positions may change without warning, so use them with caution.
from C:\Users[MY_USERNAME]\AppData\Local\Roblox\Versions\version-28296a2ecd2d4d99\content\scripts\PlayerScripts\StarterPlayerScripts\ControlScript\MasterControl\DPad.lua I found this snippet:
function DPad:Create(parentFrame)
if DPadFrame then
DPadFrame:Destroy()
DPadFrame = nil
end
local position = UDim2.new(0, 10, 1, -230)
DPadFrame = Instance.new('Frame')
DPadFrame.Name = "DPadFrame"
DPadFrame.Active = true
DPadFrame.Visible = false
DPadFrame.Size = UDim2.new(0, 192, 0, 192)
DPadFrame.Position = position
DPadFrame.BackgroundTransparency = 1
…
end
You could also check Thumbpad.lua and Thumbstick.lua as well.
Yeah, you probably don’t want to edit the values in these scripts. If you edited the values, it would be a local change anyways and not affect other players. Why I was pointing out those scripts is that they contain the positions of the DPad and other built in Roblox UI elements, so you can position your UI elements in your scripts around them precisely, knowing the actual UDim scale and offset of each UI element. Say no to guess and check methods of positioning around UI elements! ^.^
The ControlScript IdiomicLanguage shared above is cloned into StarterPlayerScripts at startup, so a possible solution would be to replace 'em with a modified version that better fits your game’s needs?
As the Roblox Developer Hub states, a more reliable way is to position the mobile button relative to the Jump Button, here is an example from the Roblox Developer Hub:
-- Get reference to player's jump button
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
local TouchGui = PlayerGui:WaitForChild("TouchGui")
local TouchControlFrame = TouchGui:WaitForChild("TouchControlFrame")
local JumpButton = TouchControlFrame:WaitForChild("JumpButton")
-- Get absolute size and position of button
local absSizeX, absSizeY = JumpButton.AbsoluteSize.X, JumpButton.AbsoluteSize.Y
local absPositionX, absPositionY = JumpButton.AbsolutePosition.X, JumpButton.AbsolutePosition.Y
-- Create new button above jump button
local customButton = Instance.new("ImageButton")
customButton.Parent = ScreenGui
customButton.AnchorPoint = Vector2.new(0.5, 1)
customButton.Size = UDim2.new(0, absSizeX*0.8, 0, absSizeY*0.8)
customButton.Position = UDim2.new(0, absPositionX+(absSizeX/2), 0, absPositionY-20)
you might need to use UserInputService instead to detect which input type they are on and create the button yourself