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)
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)
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
The Mouse object does not have a Position property.
I meant .X and .Y lol
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
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.