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

Is there a way to detect what platforms players are on ?

Asked by 6 years ago
Edited 6 years ago

Is there a way if a player is playing on a mobile device so you can code it to do something like like if player is on mobile then do that?

3 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

There is no way to be 100% sure what platform a player is playing on. However, you can get a pretty good idea with some of UserInputService's functions

local UserInputService = game:GetService("UserInputService")

UserInputService:KeyBoardEnabled() --If true it's most likely PC

UserInputService:TouchEnabled() --If true it's most likely a mobile device

--If neither are true it's most likely console
--If both are true it's most likely a laptop with a touchscreen
Ad
Log in to vote
0
Answered by 6 years ago

Game:GetService'UserInputService':GetPlatform

Log in to vote
-1
Answered by
Cactj -2
6 years ago

Yes there is. here you go. Put this in a script and insert it in the part.

script.Parent.Touched:Connect(function(what)

    print("This platform has been touched.")

end

Answer this question