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

How Can I make a ScreenGui appear when the mouse is hovering over a part?

I already know about the '.MouseHoverEnter" stuff but I am lost on how to make a Gui appear. Do I need a local script?

1 comment

0

Just make a GUI and put it in the Lighting and create a part and insert click detector and script in it and write a script showing that when a player hovers the mouse over the part it creates a clone of that gui from lighting and place it in playerGUI.

3 answers

You could place SurfaceGui's around the part, and when it's hovered, find the closest player.

You can keep the screengui in playergui if you want. The "Player" parameter tells you which player clicked it. We can then go to the Players gui by finding the players name. (I'm not sure if you can just do "Player.PlayerGui", you can try it out.

You will need to change the script depending on the screengui name and stuff

script.Parent.ClickDetector.MouseHoverEnter:connect(function(Player)
	game.Players:FindFirstChild(Player.Name).PlayerGui.ScreenGui.Frame.Visible = true
end)

script.Parent.ClickDetector.MouseHoverLeave:connect(function(Player)
	game.Players:FindFirstChild(Player.Name).PlayerGui.ScreenGui.Frame.Visible = false
end)

Just make a GUI and put it in the Lighting and create a part and insert click detector and script in it and write a script showing that when a player hovers the mouse over the part it creates a clone of that gui from lighting and place it in playerGUI.

script.Parent.ClickDetector.MouseHoverEnter:connect(function()
	game.Lighting.ScreenGui:clone().Parent=game.Players.LocalPlayer.PlayerGui
end)

script.Parent.ClickDetector.MouseHoverLeave:connect(function()
	game.Players.LocalPlayer.PlayerGui.ScreenGui:Destroy()
end)

1 comment

0

You can't use LocalPlayer in a regular script in any real server setting, and you can have Local Scripts in workspace.

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