Mobile compatibility

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local TakeLowerBun = game.Workspace:WaitForChild('Freezer'):WaitForChild("TakeLowerBurgerBun")
local TakeUpperBun = game.Workspace:WaitForChild('Freezer'):WaitForChild("TakeUpperBurgerBun")

local LowerBun = game.ReplicatedStorage:WaitForChild("Tools"):WaitForChild("Lower burger bun")
local UpperBun = game.ReplicatedStorage:WaitForChild("Tools"):WaitForChild("Upper burger bun")

local UI = player.PlayerGui.Hover

local Mouse = player:GetMouse()

local itemInfo = {
    TakeLowerBurgerBun = "Lower burger bun",
    TakeUpperBurgerBun = "Upper burger bun"
}

Mouse.Move:Connect(function()
    if Mouse.Target then
        if itemInfo[Mouse.Target.Name] ~= nil then
            UI.Item.Visible = true
            UI.Item.Text = itemInfo[Mouse.Target.Name]
            UI.Item.Position = UDim2.new(0, Mouse.X, 0, Mouse.Y) + UDim2.new(0, 15, 0, 0)
        else
            UI.Item.Visible = false
        end
    end
end)


TakeLowerBun.ClickDetector.MouseClick:Connect(function()
    if player.Backpack:FindFirstChild("Lower burger bun") == nil then
        LowerBun:Clone().Parent = player.Backpack
    end
end)

TakeUpperBun.ClickDetector.MouseClick:Connect(function()
    if player.Backpack:FindFirstChild("Upper burger bun") == nil then
        UpperBun:Clone().Parent = player.Backpack
    end
end)

this I just started making and it will eventually be a big part of my game so i decided to stop early and ask how i can make this mobile compatible. I like the UI being next to the mouse when you hoven over the item but a player on Mobile does not have a mouse so is there an equivalent or something similar i can do to achieve the same result for mobile. For pc this works fine

You could use UserInputService.TouchLongPress to detect when a player is pressing on something. This event gives you the touch position so you can check if those positions are where the UI is located. To check for a specific GUI at a specific position(In pixels) you’d do StarterGui:GetGuiObjectsAtPosition

The object is a physical object in workspace not a ui