Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I use Enum.UserInputType.MouseMovement?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.