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: Viewports

Previous Thread :: Next Thread 
C_Sharper is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. C_Sharper
Joined: 03 Oct 2011
Total Posts: 6405
29 Jul 2016 03:58 PM
Thank you.
Report Abuse
C_Sharper is not online. 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 is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
29 Jul 2016 04:00 PM
AbsoluteSize is Offset, not scale :)


Report Abuse
C_Sharper is not online. 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 is not online. 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 is not online. C_Sharper
Joined: 03 Oct 2011
Total Posts: 6405
29 Jul 2016 06:16 PM
Okay. Thanks. :)
Report Abuse
C_Sharper is not online. C_Sharper
Joined: 03 Oct 2011
Total Posts: 6405
30 Jul 2016 11:23 AM
Isn't working.
Report Abuse
C_Sharper is not online. C_Sharper
Joined: 03 Oct 2011
Total Posts: 6405
30 Jul 2016 02:48 PM
Can't get it working. :/
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