#Is there a mobile equivalent?

1 messages · Page 1 of 1 (latest)

peak drum
#

trying to make this work for mobile/tablet players. Only works for laptop/pc users.

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local part = workspace:WaitForChild("Part3")

local function createGui()
    local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
    local textLabel = Instance.new("TextLabel", screenGui)
    local UICorner = Instance.new("UICorner", textLabel)
    local UIStroke = Instance.new("UIStroke", textLabel)

    textLabel.Visible = false
    textLabel.Size = UDim2.new(0, 200, 0, 50)
    textLabel.Text = "Test"
    textLabel.BackgroundColor3 = Color3.fromRGB(84, 119, 171)
    textLabel.BackgroundTransparency = 0.25
    textLabel.TextScaled = true
    textLabel.RichText = false
    --textLabel.TextSize = UDim2.new(50)
    textLabel.Font = Enum.Font.Arimo
    UICorner.CornerRadius = UDim.new(0, 5)
    UIStroke.Enabled = true
    UIStroke.Thickness = 0.5
    UIStroke.Color = Color3.fromRGB(76, 158, 234)
end
    local function onMouseMove(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement then
            local target = mouse.Target
            if target == part then
                textLabel.Visible = true
                textLabel.Position = UDim2.new(0, mouse.X + 10, 0, mouse.Y + 10)
            else
                textLabel.Visible = false
            end
        end
    end
    UserInputService.InputChanged:Connect(onMouseMove)

player.CharacterAdded:Connect(function()
    createGui()
end)

createGui()
#

any ideas?

fresh meadow
#

what u try to do @peak drum

peak drum
# fresh meadow what u try to do <@1138015045645774848>

i've tried to change it to touch input and create a new function but no luck

    local function onTouchTap(input)
        if input.UserInputType == Enum.UserInputType.Touch then
            local target = mouse.Target
        if target == part then
            textLabel.Visible = true
            textLabel.Position = UDim2.new(0, mouse.X + 10, 0, mouse.Y + 10)
        else
            textLabel.Visible = false
        end
    end

    UserInputService.TouchTapInWorld:Connect(onTouchTap)
sharp hawk
#

what are you trying to DO

#

a ui button?

rare jolt