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

When you hover over someone, I want a gui to pop up. How can i do this?

Asked by 7 years ago

Heres what I tried ~~~~~~~~~~~~~~~~~ local Mouse = game.Players.LocalPlayer:GetMouse() Mouse.Moved:connect(function()

if Mouse.Target.Parent:FindFirstChild('Humanoid') then
    end

end ~~~~~~~~~~~~~~~~~

1 answer

Log in to vote
2
Answered by 7 years ago

The first Problem is that Moved is not a function of the mouse, Move is. Secondly, I don't recommend looking for the humanoid, because this could include NPCs. Check to see if Mouse.Target.Name is able to be found in game.Players

But you can't stop there. The mouse never actually hovers over the model, it hovers over the players body parts (ex LeftArm, RightLeg) so we solve that by doing Mouse.Target.Parent.Name

Here is your finalized script.

local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Move:connect(function()
    if Mouse.Target ~= nil then --Check to make sure Mouse is not pointing at the sky
        if game.Players:FindFirstChild(Mouse.Target.Parent.Name) then --Key Line
            print('Found Player: '..Mouse.Target.Parent.Name)
        end     
    end
end)
Ad

Answer this question