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 8 years ago

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

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

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

1 answer

Log in to vote
2
Answered by 8 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.

1local Mouse = game.Players.LocalPlayer:GetMouse()
2 
3Mouse.Move:connect(function()
4    if Mouse.Target ~= nil then --Check to make sure Mouse is not pointing at the sky
5        if game.Players:FindFirstChild(Mouse.Target.Parent.Name) then --Key Line
6            print('Found Player: '..Mouse.Target.Parent.Name)
7        end    
8    end
9end)
Ad

Answer this question