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

How can I use Enum.UserInputType.MouseMovement?

Asked by
nilVector 812 Moderation Voter
10 years ago

How can I use Enum.UserInputType.MouseMovement to check if you are hovering your mouse over a player.

I want to check if you're hovering your mouse over a player to make a GUI appear.

This my scrap code for the situation (in a local script):

wait()

--User Input Service
local service = game:GetService("UserInputService")
local player = game.Players.LocalPlayer

service.InputBegan:connect(function(input)
    --Mouse Moved Event
    if input.UserInputType == Enum.UserInputType.MouseMovement then
        --I don't know this part.
        --How do I check if the player is hovering over another player?
        if --[[Condition]]-- then
            script.Parent.PlayerName.Text = --Player You're Hovering Over
        end
    end
end)

I already know about mouse.Target where you define mouse as player:GetMouse(). However, I do not want to use that, because it's glitchy and it pops up the GUI even when the mouse leaves the player. I would prefer to use the UserInputService, because it seems more reliable.

1 answer

Log in to vote
0
Answered by
anerth 25
10 years ago

No code here, or anything, but maybe check if you are hovering your mouse over a humanoid. (BTW I saw your group post. I agree.)

Ad

Answer this question