Make Guis Only Visible for Mobile Users and Vice Versa with PC Users?

I’ve realized upon making my game how unplayable it is in terms of the ui placement for mobile users. I’ve made a ui that is only visible for mobile users but I can’t figure out how to hide the current uis that I have for the pc users. It’s fine on the pc users end but I want it when a mobile user joins in, they can’t view the ui that I have for the pc users. Is there a way to do that?

2 Likes

You should use Scale and not offset for this.
UDim2.New(XScale,XOffset,YScale,YOffset)

Scale will resize to fit the screen.
Offset will not.

I use this Plugin to help me scale. AutoScale Lite - Roblox

But if you still want to make multiple versions of the same UI. Use UserInputServies.

:warning:Make both frames Visible set to false.

local uis =  game:GetService("UserInputService")

if uis.TouchEnabled then
	-- phone user
    PhoneFrame.Visible = true -- change to phone Frame
elseif uis.GamepadEnabled then
	-- xbox/console
else
	-- pc user
    PCFrame.Visible = true -- change to pc Frame
end
3 Likes

yeah i tried a script similar to that and for some reason it just doesn’t work. perhaps it has to do with the location of the script? I have the script in the startergui and its a local script.

Edit: I ended up figuring it out lol. So similar method to what you were saying but this ended up working for me down below

uis = game:GetService("UserInputService")
ismobile = uis.TouchEnabled --This line checks if the player is on mobile

if ismobile then
	script.Parent.Visible = false
end

Me putting this script inside any gui that I don’t want mobile users to have access to ended up working. And by putting:

uis = game:GetService("UserInputService")
ismobile = uis.TouchEnabled --This line checks if the player is on mobile

if ismobile then
	script.Parent.Visible = ismobile
end

Makes it so that only pc users have access to the guis. Thanks for the help btw!

Edit 2: I’ll mark yours as the solution, seeing that it lead me in the right direction.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.