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

Is it possible to detect a device?

Asked by 9 years ago

I know this isn't an Ask and Get service, but I want to know if it is possible to detect what device is being used.

Basically, I need a script that goes through something like

if Player is on Android/IOS --Or whatever the first bit of the script will be

game.Lighting.gear:Clone().Parent=Player.Backpack
game.Lighting.gear:Clone().Parent=Player.StarterGear

end

If anyone knows, that will be grand!

  • Michael

1 answer

Log in to vote
5
Answered by 9 years ago

Not sure if this helps, I don't know of any way to check what device is being used, but there is a way to check if there's a touch screen connected. Maybe we can put something together that checks if there's a touch screen but no mouse and keyboard then it may be a phone or tablet. I didn't test this script.

local Input = Game:GetService('UserInputService')
if Input.TouchEnabled and not Input.MouseEnabled and not Input.KeyboardEnabled then
    game.Lighting.gear:Clone().Parent=Player.Backpack
    game.Lighting.gear:Clone().Parent=Player.StarterGear
end

Maybe there is another way around, but this is what I can come up with.

0
Thanks! I guess this will do for a while until a new script surfaces its self or some new APIs show up. Michael007800 144 — 9y
Ad

Answer this question