So I’m trying to make a system that changes a GUI based on the player’s platform. Now I know that detecting the player’s platform is considered unreliable due to the fact that you can use a controller on a PC and you can use mobile controls on a touch screen laptop. However, for what I am using it for it doesn’t really matter. Do note I have tried this script in both a server and local script without any success and without any errors.
Here’s the script:
local platformimage = script.Parent
local UIS = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled
and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then
platformimage.Visible = true
platformimage.Image = "rbxassetid://7742783698"
end
if not UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled
and UIS.GamepadEnabled and GuiService:IsTenFootInterface() then
platformimage.Visible = true
platformimage.Image = "rbxassetid://7742783698"
end
local GuiService = game:GetService("GuiService")
local UIService = game:GetService("UserInputService")
local Platform
if GuiService:IsTenFootInterface() then
Platform = "console"
elseif UIService.TouchEnabled and not UIService.MouseEnabled then
if workspace.CurrentCamera.ViewportSize.Y > 600 then
Platform = "tablet"
else
Platform = "phone"
end
else
Platform = "pc"
end
If it has to do with a GUI I suggest client-sided (a local script), what you and @zrax_rb used UserInputService is, a client-sided service. So it should be client-sidedly, I suggest if you do want to send information from client to server use RemoteEvents.
Edit: Please close the topic if you can by marking a post above as solution.