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

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

Asked by 6 years ago

: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

Log in to vote
0
Answered by 6 years ago

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

Ad

Answer this question