my device detecting script won’t work. from pc when i join it works perfect but when i join from a phone its not working.
the BillBoardGui needs to clone to players head and display a small img with the device he uses.
local script(ReplicatedFirst):
player = game.Players.LocalPlayer
UserInputService = game:GetService("UserInputService")
Console = UserInputService.GamepadEnabled
Pc = UserInputService.KeyboardEnabled
Mobile = UserInputService.TouchEnabled
wait(20)
if Pc then
game.ReplicatedStorage.device:FireServer("Pc")
print("fired")
elseif Mobile then
game.ReplicatedStorage.device:FireServer("Mobile")
print("fired mobile")
elseif Console then
game.ReplicatedStorage.device:FireServer("Console")
print("fired console")
end
server script(ServerScriptService):
game.Players.PlayerAdded:Connect(function(player)
local ServerStorage = game:GetService("ServerStorage")
local GuiFolder = ServerStorage:FindFirstChild("DeviceGui")
game.ReplicatedStorage.device.OnServerEvent:Connect(function(plr,Device)
player.CharacterAdded:Connect(function(character)
if Device == "Pc" then
GuiFolder:FindFirstChild("BillboardGuipc"):Clone().Parent = player.Character:FindFirstChild("Head")
elseif Device == "Mobile" then
GuiFolder:FindFirstChild("BillboardGuimo"):Clone().Parent = player.Character:FindFirstChild("Head")
elseif Device == "Console" then
GuiFolder:FindFirstChild("BillboardGuico"):Clone().Parent = player.Character:FindFirstChild("Head")
end
end)
end)
end)