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).

3 comments

0

What if the player has both touchscreen and keyboard/mouse?

0

What errors are you getting or what issue are you having?

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