Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it so when a mobile user loads a gui its differant to one that a PC user will have?

Asked by 6 years ago
Edited 6 years ago
local Enter = script.Parent.Union.Enter
local Rs = game.ReplicatedStorage
local Gg = Rs.GameGuis
local UIS = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")

Enter.Touched:Connect(function(plr)
    if (not plr.PlayerGui) then return end
    if (not plr.PlayerGui:FindFirstChild("Foods")) then
    if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled and not         GuiService:IsTenFootInterface() then
        local x = Gg.Drinks:Clone()
        x.Parent = plr.PlayerGui
    elseif UIS.KeyboardEnabled and UIS.MouseEnabled and GuiService:IsTenFootInterface() then
        local y = Gg.Foods:Clone()
        y.Parent = plr.PlayerGui
    end
end
end)

Is my code so far, However it isn't working. I need some help here..

Im trying to make it so, If someone has a touchscreen, BUT no keyboard / mouse input it selects one gui, However if it has a keyboard and mouse and no touchscreen then I want it to show another. (The gui names are just for testing).

0
What if the player has both touchscreen and keyboard/mouse? User#21908 42 — 6y
0
What errors are you getting or what issue are you having? gullet 471 — 6y
0
Touched does not pass the player who touched as an argument. It's the other part which touched it, so you're really just saying game.Workspace.Part.PlayerGui or something, and UserInputService cannot be used from the server User#19524 175 — 6y

Answer this question