hello dev forum im trying to make a label pop up when my mouse is over certain props but i cant find on how to do it or what its even called. but im trying to get a slim label to apear and sorta do something im not sure but i mainly am just trying to get it so apear when the mouse is over the prop
this gif is kindaa what i mean with my mouse
its gonna be the last thing i do before i start working on maps
and here is the game
https://www.roblox.com/games/5949918370/Stare-at-a-Broken-pc?refPageId=67a8825e-51af-44a7-a08e-97f49f130b09
You can use Mouse.Move
to make it trigger whenever the mouse is moving around your prop. Then you can do Mouse.Target
to see if the Target ~= nil and if it’s equal to your objects name.
Don’t forget to also put the label in your mouse’s position.
TextLabel.Position = UDim2.new(0.003, Mouse.X, -0.025, Mouse.Y)```
that feels familiar but how would i get the guis to pop up even when the mouse is hovering over it and stil do something like move?
That’s what Mouse.Move is for.
local localPlayer = game.Players.LocalPlayer
local Mouse = localPlayer:GetMouse()
Mouse.Move:Connect(function()
script.Parent.Position = UDim2.new(0, Mouse.X + -5, 0, Mouse.Y + -5)
script.Parent.Visible = false
local Target = Mouse.Target
if Target and Target.Name == "PC" then
script.Parent.Text = Target.Name
script.Parent.Visible = true
end
end)
The script above should work as it works for me. Just ask me anything if there is an error.
how would i set it up though? like with text guis?
Well, sorry for not saying. You should put that script in a localscript and in a gui
so id make a frame for gui oh the entire screen put a local script in each of the things i want to pop up?
well, imma publish the whole thing as a model
this way is just a basic one that i know.
its not letting me open it is it s a game file or something else i can try?
Sorry, I am currently on mobile. So I am going to show you what did I do:
- Create a TextLabel in a Gui
- Add a LocalScript in the TextLabel and put the code above there.
im also gonna be doing this o the game so i want to be sure im going to add maps other then this one i just want to finish some special touches before i start working on more maps so will i be able to just switch to a different map and the gui is still there and will get in the way so i think ill need to make it disaoear on key change or somthing like that
Does the script work or there is any error?
there is an error on Player
how would i fix that?
I fixed that. You should scroll up and check it
ive done what u said and nothings happening it loads in and disapears
Well, are there any errors? You should untick the ResetOnSpawn property of the Gui.