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

How to make GUI show up when mouse hover over a player?

I made a bit of code like this: When you hover your mouse over a part, a GUI shows up. Instead, I want to replace with a player whole body. I still don't know where should you put the script into. Thanks for helping! This is what I've made so far!

local mouse = game.Players.LocalPlayer:getMouse()

mouse.Move:connect(function()
 script.Parent.Parent.TextLabel.Position = UDim2.new(0, mouse.X, 0, mouse.Y)
end)

script.Parent.MouseEnter:connect(function()
 script.Parent.Parent.TextLabel.Visible = true
end)

script.Parent.MouseLeave:connect(function()
 script.Parent.Parent.TextLabel.Visible = false
end)

2 comments

0

You can check the base part of what the mouse hits and if it is a player

0

Ok thanks!

1 answer

✓ Accepted answer

My Code:

-- Obviously needs to be a local script.
wait(1)
plr = game.Players.LocalPlayer
char = plr.Character
gui = script.Parent.Parent
cd = Instance.new('ClickDetector', char.HumanoidRootPart)
cd.MouseEnter:Connect(function()
	gui.Visible = true
end)
cd.MouseLeave:Connect(function()
	gui.Visible = false
end)

2 comments

0

thanks!

0

no problem, just make sure in the event you have the gui's position set to be wherever you want it to be on the screen, like diagonally or something

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