C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
|
| 29 Jul 2016 03:47 PM |
Here's my thing.
port.ViewportSize.X / m.X
For the X position of the scaled position of my UI slider bar.
It doesn't work properly. M is the mouse variable. |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 29 Jul 2016 03:49 PM |
| Scale position? m.X will be in pixels so if you use it for scale you'll get something from 0 to 1920 (on a 1920x1080 screen) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 03:49 PM |
ViewPort is read only, you cannot change it for them
|
|
|
| Report Abuse |
|
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
|
| 29 Jul 2016 03:51 PM |
I'm not changing it. I'm getting the data from it....
I reversed the order and it works now. But not perfect, any help?
I want to move this UI element to the mouse position, but I want it to be scaled. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 03:57 PM |
p = game.Players.LocalPlayer mouse = p:GetMouse() gui = -- define your GUI mouse.Changed:connect(function() gui.Size = UDim2.new(0,ViewSizeX/2,0,ViewSizeY/2) gui.Position = UDim2.new(0,mouse.X-(gui.AbsoluteSize.X/2),0,mouse.Y-(gui.AbsoluteSize.Y/2)) end)
|
|
|
| Report Abuse |
|
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
| |
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
|
| 29 Jul 2016 04:00 PM |
Hm, this isn't working.
bar.Position = UDim2.new(m.X - (bar.AbsoluteSize.X / 2),0,bar.Position.Y.Scale,0) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 04:00 PM |
AbsoluteSize is Offset, not scale :)
|
|
|
| Report Abuse |
|
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
|
| 29 Jul 2016 04:04 PM |
oh..
I want it to be scaled though. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 04:05 PM |
Then get the scale instead of the AbsoluteSize. That's just Gui.Size.Scale.X, I think
|
|
|
| Report Abuse |
|
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
| |
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
| |
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
| |
|