UserInput problem

I have a code that enables a UI if a player is playing on mobile but it’s not working.

local UIName = "PhoneShow"

local InputService = game:GetService("UserInputService")

game.Players.PlayerAdded:Connect(function(plr)
	
	local isPhone = InputService.TouchEnabled
	local isPc = InputService.MouseEnabled or InputService.KeyboardEnabled
	
	if isPhone and not isPc then
		plr:WaitForChild("PlayerGui"):WaitForChild(UIName).Enabled = true
	else
		print(isPhone)
		print(InputService.KeyboardEnabled)
		print(InputService.MouseEnabled)
	end
end) 

it prints

false 
true 
true 

even if I join from a phone.

This Code is a servers script and is in serverscriptservice

UserInputService can only be accessed through a local script.

1 Like

It seems to be accessible from the server too, but it won’t work properly.

Yes but you can’t use those properties in a server script.

I was able to print those properties on the command bar of the developer console, which is server side. But, of course, it doesn’t give the client values for those properties. So, yes, it’s useless to use them on the server.

Yes I’m just dumb, all I know is that it won’t work on the server… Also we told him the problem and he isn’t coming back here lol.