generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do you convert the mouse's position into a UDim2?

Previous Thread :: Next Thread 
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
03 Jun 2015 05:10 PM
^?
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
03 Jun 2015 05:11 PM
Mouse.X
Mouse.Y
Report Abuse
XanthicDragon is not online. XanthicDragon
Joined: 19 Jul 2011
Total Posts: 2780
03 Jun 2015 05:11 PM
local mouse = game:GetService("Players").LocalPlayer:GetMouse()

game:GetService("RunService").RenderStepped:connect(function ()
local UD2 = UDim2.new(0, mouse.X, 0, mouse.Y)
end)
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
03 Jun 2015 05:12 PM

UDim2.new(0,Mouse.X,0,Mouse.Y)
Report Abuse
ohno1112 is not online. ohno1112
Joined: 23 Mar 2013
Total Posts: 833
03 Jun 2015 05:14 PM
or, literally use it as a function, like this:


function GetMouseUdim2(obj)
if obj.ClassName == "Mouse" then
return UDim2.new(0,Mouse.X,0,Mouse.Y)
else
return nil
end

local mouse = game:GetService("Players").LocalPlayer:GetMouse()

mousepos = GetMouseUdim2(mouse)


Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
03 Jun 2015 05:21 PM
function GetMouseUdim2(obj)
return obj.ClassName == "Mouse" and UDim2.new(0,obj.X,0,obj.Y) or nil
end
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
03 Jun 2015 05:23 PM
mouse.Move:connect(function()
label.Position = UDim2.new(mouse.X.Scale, mouse.X.Offset, mouse.Y.Scale, mouse.Y.Offset)
end)

Doesn't work?
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
03 Jun 2015 07:13 PM
bump


Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
03 Jun 2015 07:14 PM
nvm didnt read xan's post
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
03 Jun 2015 07:14 PM
You're an idiot.
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
03 Jun 2015 07:15 PM
mouse.X and mouse.Y are already the offsets.
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
03 Jun 2015 07:17 PM
No need to be rude sir

I didn't know they were already offsets
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image