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

How to make a gui appear once it hovers over a part?

Asked by 5 years ago

In my game, I want there to be objects where if you hover over them, a certain gui appears. I can't just reference it, because the item could be destroyed or cloned in a certain part of the game. I can't think of any way to do this. What can I do for this?

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

If you want to make a gui apper when the mouse is hovering a part and name it whatever then it you would want to make a screengui and add a TextLabel in the screengui. Insert a local script in the **TextLabel **and type this.

01local player = game:GetService("Players").LocalPlayer
02 
03local mouse = player:GetMouse()
04 
05 
06--main script
07mouse.Move:Connect(function()
08    script.Parent.Position = UDim2.new(0, mouse.X + 5, 0, mouse.Y + 10) -- location of the Gui
09    script.Parent.Visible = false
10    local target = mouse.Target
11    if target and target.Parent then
12        if target.Parent.ClassName == "Model" then -- if the object that you're mouse is hovering is a model then the name of the object will show
13            script.Parent.Text = target.Parent.Name
14            script.Parent.Visible = true
15        end
View all 31 lines...

Please do comment this if you want a other version.

0
How can I make it so that it can only be activated if a player is withing a stud distance, and if they leave it, the gui will tween out aswell? DejaSketch 84 — 5y
0
Ok i will edit this Eric_pokemon 133 — 5y
0
Ok i will edit this Eric_pokemon 133 — 5y
0
If you want to make a distance then you can use magnitude or learn it Eric_pokemon 133 — 5y
Ad

Answer this question