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