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

How would I make a script activate when a player's mouse hovers over an Instance?

:I'm making a script for my zombie game for when a player's mouse hovers over the zombie, it shows a table of useful statistics above it. And when the player's mouse leaves, it disappears. I want it to only appear for the player that hovered over it, and not the other players, would this require a local script? I don't want to use click detector because it changes the player's mouse cursor to that ugly hand decal when it hovers over it, is there anything else I could try? Either an explanation or a Roblox wiki link would be great! (And this isn't a request, just wondering what I would have to use to make this work so I can expand on it and use it for my other games).

1 answer

✓ Accepted answer

You have to wrap the mouses target in a render step:

local p = game:GetService("Players").LocalPlayer
local m = p:GetMouse()
game:GetService("RunService").RenderStepped:Connect(function()
    print(m.target)
end)

I wrote this on phone lol

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