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

Mouse target on mobile not working?

Asked by 4 years ago

Mouse target on mobile is super weird i basically want to see if my simulated mouse icon for mobile is hovering over any part heres my attempt

local mouse = game.Players.LocalPlayer:GetMouse()
local gui = script.Parent

mouse.Move:Connect(function()
if gui.Position == mouse.Target.Position then
if mouse.Target.Name == "Special" then
print"gui is hovering over a special part!"
end
end
end)

I try this but it doesn't print anything or do anything my guess is the first if statement is not passing?

0
It wont work on mobile as on mobile they don't have a mouse. deth836231 142 — 4y
0
mouse.Target will be nil when no base part is found so .Position will cause an error. Why are you compareing the gui position to the mouse position? User#5423 17 — 4y

Answer this question