Overhead device icon not working

Hey developers, I’m currently working on a game which has an overhead device icon that looks like this:

image

As you can see, this player with is on a PC so the game displays the icon as a PC, for mobile players it will display a mobile icon above their head.

When I test this in a local player server in studio it works perfectly fine but, the problem is in the actual game where it displays the icon as PC for a mobile player.

The script in charge of this is in ServerScriptService. “mainscript” clones the overhead above the players head. “ICONSCRIPT” changes the icon.
image

ICONSCRIPT:

local userInputService = game:GetService("UserInputService")

if userInputService.TouchEnabled == false then 

script.Parent.Image = "rbxassetid://4997995083"  --pc icon

elseif userInputService.TouchEnabled == true then

script.Parent.Image = "rbxassetid://8957831949" --phone icon

end

Help is appreciated, Thank you!

UserInputService won’t work on ServerScripts. You could detect from a LocalScript, then FireServer with a RemoteEvent to a ServerScript.

1 Like