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

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

Asked by 4 years ago
Edited 4 years ago

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)
0
You can check the base part of what the mouse hits and if it is a player User#5423 17 — 4y
0
Ok thanks! MinuhaYT 19 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
0
thanks! MinuhaYT 19 — 4y
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 AlphaWolf536791 28 — 4y
Ad

Answer this question