When I try adding UI into the TouchGui, it works in studio when using the emulator, however, the added UI on actual mobile seems to just not appear. It is being created, and the parent is there, as I’ve added prints to make sure. but it is not visible
Studio emulator
Mobile
Can see (in the mobile background) that there’s no sprint button, yet the console is printing that it’s being added
function TouchGuiController:CreateSprintButton()
print("CREATE")
local TouchControlFrame = TouchGui:WaitForChild("TouchControlFrame")
local JumpButton = TouchControlFrame:WaitForChild("JumpButton")
print("JMUP")
local SprintButton = Instance.new("ImageButton")
SprintButton.AnchorPoint = Vector2.new(0.5, 1)
SprintButton.BackgroundTransparency = 1
SprintButton.Name = "SprintButton"
SprintButton.Position = UDim2.fromOffset(
JumpButton.AbsolutePosition.X + (JumpButton.AbsoluteSize.X / 2),
JumpButton.AbsolutePosition.Y - (JumpButton.AbsoluteSize.Y / 5)
)
SprintButton.Size = DeviceController.Device == "Tablet" and UDim2.fromScale(0.1, 0.1)
or UDim2.fromScale(0.175, 0.175)
SprintButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
SprintButton.Parent = TouchControlFrame
print(SprintButton.Parent)
local SprintButtonDesign = UI.Cloned.MobileButton:Clone()
SprintButtonDesign.Icon.Image = Icons.Mobile.Sprint
SprintButtonDesign.Label.Text = "Sprint"
SprintButtonDesign.Parent = SprintButton
-- Sprint button was pressed
SprintButton.InputBegan:Connect(function()
if SprintController.Sprinting.Value then
SprintController:Stop()
SprintButtonDesign.Outline.BackgroundTransparency = 1
else
SprintController:Begin()
SprintButtonDesign.Outline.BackgroundTransparency = 0.25
end
end)
print("COMPLETE")
end