Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a platform detection system??

Hello guys, I wanted to make a system where you find out which platform the player is playing on. To have no problems in the game. Can anyone help me how can I do this?

1 comment

0

Use UserInputService

2 answers

✓ Accepted answer

UserInputService This is a roblox game service used to detect client/player's available input types which can be retrieved by GetService() function

Example Basic Code:

local UIS = game:GetService("UserInputService")
local GS = game:GetService("GuiService")

local player = game.Players.LocalPlayer

if GS:IsTenFootInterface() then
	warn("Player on XBOX!")
elseif UIS.TouchEnabled and UIS.KeyboardEnabled == false then
	warn("Player on MOBILE!")
elseif UIS.TouchEnabled == false and UIS.KeyboardEnabled then
	warn("Player on PC")
end

More Information about UserInputService:

https://developer.roblox.com/api-reference/class/UserInputService

https://developer.roblox.com/api-reference/function/UserInputService/GetLastInputType

https://developer.roblox.com/api-reference/event/UserInputService/LastInputTypeChanged

You can also use remotes to acheieve this, by checking if there is anything touching that part the HumanoidRootPart and then fire that players RootPart in a server script and pick it up on the client and check if the player is there and print the players name or do stuff wtih that players humanoid root part, you can use UIS too.

This discussion is preserved as it was. New answers, comments, and votes are closed.