I don’t mean to be rude, but the OP asked for the most accurate way, not how to do this.
Some methods of detecting may be less accurate than others.
Also, what about Xbox? Would the best way be just to detect a controller input? I know the OP doesn’t mention this in their question, but I’m intrigued.
There’s actually a method in the documentation, specifically GuiService:IsTenFootInterface that accurately detects if someone is on Xbox, which is why I didn’t include it in the original post.
Thank you for linking that reply. This is exactly what I’m looking for. I can assume that’s an accurate method given how many likes it got. I appreciate your help.
You should not detect whether the player is on a particular platform, you should check what their latest input mode is, and what their screen size is, and adjust the UI according to that.
This is written in the post you have linked (note the edits and such made to the post). Please do not use the outdated snippet in here as it will lead to broken UX on many kinds of devices and use the API I linked there instead.