Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How can I make a platform detection system??

Asked by 4 years ago

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?

0
Use UserInputService Feelings_La 399 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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

Ad
Log in to vote
0
Answered by 4 years ago

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.

Answer this question