So I have a nametag system.
Part of it is the user device detecting.
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local inputService = game:GetService("UserInputService")
local replicated = game:GetService("ReplicatedStorage")
local remotes = replicated:WaitForChild("Remotes")
-- Check platform
task.wait(4)
if inputService.TouchEnabled and not inputService.KeyboardEnabled then
--mobile
remotes:WaitForChild("NameTagRemote"):FireServer("platform","mobile")
elseif inputService.GamepadEnabled and not inputService.KeyboardEnabled then
--console
remotes:WaitForChild("NameTagRemote"):FireServer("platform","console")
elseif not inputService.TouchEnabled and not inputService.GamepadEnabled then
-- Load PC
remotes:WaitForChild("NameTagRemote"):FireServer("platform","pc")
end
--Afk
inputService.WindowFocusReleased:Connect(function()
remotes:WaitForChild("NameTagRemote"):FireServer("afk",true)
end)
inputService.WindowFocused:Connect(function()
remotes:WaitForChild("NameTagRemote"):FireServer("afk",false)
end)
How I load that:
--//Services
local OverheadService = require(script.OverheadService)
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAppearanceLoaded:Connect(function(Character)
OverheadService:CreateTag(Player)
end)
end)