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

Trying to get a textlabel to be on players mouse?

When I move the mouse around I want the gui to follow it.

plr = game.Players.LocalPlayer
mouse = plr:GetMouse()

Gui = script.Parent.Text

Gui.Position = UDim2.new(mouse)

1 comment

1

This shows little attempt. I'm not 100% sure, but you can't make a GUI Element's name "Text", as it may interfere with the "Text" property. I know you're completely capable of looking on the wiki and finding the correct event, considering you have 134 reputation.

1 answer

✓ Accepted answer

First problem:

:GetMouse does not return a position value. To fix this, do the following:

local pos = mouse.Position
Gui.Position = pos

Second problem:

This will only cover the mouse once, so it will not update itself, so:

while wait() do
	local pos = mouse.Position
	Gui.Position = pos
end

Tips:

  • Shawnyg's comment was wrong, it does not interfere, and will only interfere when you are searching for a child of an object with a Text property, when the child you are searching for is called Text. If you encounter this problem, consider renaming the child text, as the searches are case sensitive.

  • Always make sure something that needs to be updated is actually updating, see the second problem.

Hope I helped :)

~TDP

2 comments

0

The Mouse object does not have a Position property.

0

I meant .X and .Y lol

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