How can I prevent my experience from being accessed by a gamepad?

My experience will initially be released for PC only (it will still need a lot of work to make it playable for consoles and mobile devices).

To prevent a user from accessing the game from other devices, I can detect if it’s a gamepad using UserInputService.TouchEnabled in LocalScript and there give a warning about it and then do a RemoteEvent to a function on the Server that will do the Player:Kick().

However, exploiters can modify this in LocalScript and allow access to the game, which may produce unpredictable results for the time being.

That’s why I ask: How can I prevent my experience from being accessed by a gamepad?

First:
image

Second:
TouchEnabled detects if the user is on a device with touch screen, not if the user is using a xbox controler.

TouchEnabled will include laptops, so make sure to also have a check to see if no keyboard is enabled.

Third:
I dont think you can really check what device a player is using through the server, so local scripts are your best shot.
Anyway, heres something that should detect devices mostly correctly.
(local script)

-- with no waiting for the player, hackers shouldnt be able to modify this, as they have to load into the game, or at least open it before they can inject anything.
-- Anyway, if your game just isnt scripted for a gamepad, why would anyone want to use a gamepad? It wont work, or at most half work.
local uis = game:GetService('UserInputService')
if uis.TouchEnabled and not uis.KeyboardEnabled then
	-- user is probably on a phone / tablet
elseif uis.GamepadEnabled then
	-- user is using an xbox controler (I think)
elseif uis.VREnabled then
	-- user is in vr
else
	-- user is probably on pc
end

I’ve done this before, but it makes no difference. Even unchecked, the game continues to allow it to be run on mobile.

That’s why I created this topic.

This might sound tedious but it’s the only way i can think of
Upon playeradded on server create any value object you want under character
then afterwards on a localscript if the player is using gamepad you can delete the value and since deleting anything under character replicates, you can detect if the value is deleted then kick (Value is deleted when player joins with gamepad)

1 Like

Changes made on the client will NOT replicate to the server.

Everything you delete in LocalPlayers Character replicates to the server

1 Like

ANYTHING deleted under character will replicate to server.

1 Like

This is new for me. And researching a bit, some people say it’s a bug. But then this is apparently an exception.

It’s useless. It’s the exploiter’s problem then, its not like a normal player will boot up synapse just to play with their gamepad that DOESN’T EVEN WORK.

No. My game allows the player to create objects on a map, which currently doesn’t work well on a mobile. So I can’t allow players to enter the game with these devices for now. That’s why I create these restrictions in LocalScript. But I don’t want to allow an exploiter to remove these restrictions and create problems in the game.

They can’t create problems if you don’t even give them the tools to in the first place.

I think you don’t know what you’re talking about. nvm

Paying more attention to your idea, I realize that it will also not prevent the exploiter from removing the instruction in the LocalScript that will delete this value, thus preventing the system from detecting that it is using a gamepad.

PlayerAdded runs immediately when player joins, unless they are using auto attach and auto execute

I didn’t get it. Did you read my last post?