|
| 27 Feb 2017 07:02 AM |
The other day I was scripting my new game, and I thought to myself, wouldn't it be smart to make it so the tablet has its own GUI setup? I started to make the GUIs, but then I realized, how do I make all of the GUIs show up only on the Tablet, and the Desktop GUIs only show up while using a Desktop?
So, if anyone has a script to enable a GUI if the player is using a certain device, please copy and paste it into a reply to this thread.
Thanks!
|
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 07:06 AM |
UserInputService.TouchEnabled is best guess
|
|
|
| Report Abuse |
|
|
iiFylth
|
  |
| Joined: 17 Sep 2014 |
| Total Posts: 140 |
|
|
| 27 Feb 2017 07:09 AM |
If UserInputService.TouchEnabled then --code here(for tablet) else --code here (shows the gui for desktop) end |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 27 Feb 2017 07:09 AM |
You could check the 'TouchEnabled' property of UserInputService to decide whether or not the client is on mobile.
|
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 27 Feb 2017 07:10 AM |
lol ninja'd twice while wiki'ing
|
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 07:21 AM |
| Thank you all. I'm going to see if the scripts that you guys gave me work. Also, thank you so much for responding so quickly! |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 07:21 AM |
| Although, where do I put the script and what type of script? |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 27 Feb 2017 08:03 AM |
LocalScript in somewhere that replicates to the client
StarterPlayerScripts, StarterCharacterScripts, StarterGui, StarterPack
|
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:42 PM |
| I put it in all of those, and it wasn't working. UserInputService is marked red by the coding program. Any ideas why? |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:43 PM |
| Do what MM2 does and prompt the user for the device they are on |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:44 PM |
| to differentiate between a phone and a tablet |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:48 PM |
| Thats what I'm trying to do, but i don't know how. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:49 PM |
"prompt the user"
Ask them.
Create 2 gui button, phone and tablet with a text label asking them which device they are on |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:51 PM |
| Well i know how to do that. I want to know how to make the window for tablet / ##### appear only on those devices, and not the desktop. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:52 PM |
If UserInputService.TouchEnabled then --display the prompt else --nowt end |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:54 PM |
| It doesn't work. It said "Expected =, got UserInputService" |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:55 PM |
add this at top
local UserInputService = game:GetService("UserInputService") |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 02:57 PM |
| Still has the same message. |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 03:00 PM |
make sure it is in a localscript
if game:GetService("UserInputService").TouchEnabled == true then --prompt end |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 03:02 PM |
| Is there a way to turn that into an "If Else" script? |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 03:03 PM |
| oml im not gonna spoon feed you do it yourself |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 03:05 PM |
| Dude, I'm asking a question. It's part of the original question asked. Look at the top of this forum page! |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 03:05 PM |
| "turn is into an if else statement" this is simple lmao even a 3 year old could do it |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 03:07 PM |
| Do you just add an else under it or something like that? |
|
|
| Report Abuse |
|
|
|
| 27 Feb 2017 03:08 PM |
| yes and put the end under it |
|
|
| Report Abuse |
|
|