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
 

has anyone been able to make a circular gui

Previous Thread :: Next Thread 
enjoyablegamer321 is online. enjoyablegamer321
Joined: 05 Jul 2012
Total Posts: 9812
14 Jul 2017 09:43 PM
like maybe using an image button, but if they click outside of the circle it wouldn't register as a click

i've never seen it, and just wondering if anyone has or knows how
Report Abuse
BoredLord101 is not online. BoredLord101
Joined: 28 May 2016
Total Posts: 180
14 Jul 2017 09:44 PM
You COULD create multiple GUI button to simulate the circular hitbox, but that won't be efficient...
Report Abuse
enjoyablegamer321 is online. enjoyablegamer321
Joined: 05 Jul 2012
Total Posts: 9812
14 Jul 2017 09:45 PM
ye, so like has anyone been able to perfectly do it
Report Abuse
doggy00 is online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
14 Jul 2017 09:54 PM
Let's just make 3600 GUIs and rotate each of them by 0.1 degrees :D

Honestly, that's probably the best way to do this unless there's a way to get the distance from the mouse cursor and the GUI's center. In which case, you could just use that along with an ImageLabel of a circle.
Report Abuse
enjoyablegamer321 is online. enjoyablegamer321
Joined: 05 Jul 2012
Total Posts: 9812
14 Jul 2017 09:55 PM
there has to be a genius that has figured out a different way
Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
14 Jul 2017 09:55 PM
I could make a wrapper for the mouseclick event for buttons and to make it assume that we're using a circle.
All that needs to be done is

--Click event
if (mouse.Position - centerOfButton).magnitude > buttonSize / 2 then return end
--Code here


Report Abuse
enjoyablegamer321 is online. enjoyablegamer321
Joined: 05 Jul 2012
Total Posts: 9812
14 Jul 2017 09:57 PM
what how would that work

could you make a place demonstrating that
Report Abuse
doggy00 is online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
14 Jul 2017 09:59 PM
As I said, you would be getting the distance between the GUI button and mouse. This is essentially the radius of the circle. If you ever use magnitude then you'll notice the area it covers always makes a circle (or sphere if you're working with 3D objects).
Report Abuse
samy22 is not online. samy22
Joined: 28 Sep 2008
Total Posts: 2181
14 Jul 2017 09:59 PM

function click()
local cc = circleCenterPos
local cr = circle radius value
local mXpos = mouse.X
localmYpos = mouse.Y

if (mXpos - cc.x)^2 + (mYpos - cc.y)^2 < cr^2 then
print("Click was in the circle.")
end

end
Report Abuse
samy22 is not online. samy22
Joined: 28 Sep 2008
Total Posts: 2181
14 Jul 2017 10:00 PM
Aw.. i was beat to it.

Gotta love time spent trying to fix roblox filter.
Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
14 Jul 2017 10:00 PM
Unfortunately I'm going to sleep now, it's 03:57. But when I wake up I'll get to the code if I don't forget.
It should be fairly easy.

local position = Vector2.new(Mouse.X, Mouse.Y)
local size = Button.AbsoluteSize
local centerOfButton = Button.AbsolutePosition + Button.AbsoluteSize / 2

But I can't remember if it's AbsoluteSize.X (Or .Y) or X.AbsoluteSize (Or Y.), but I'm pretty sure I'm on the right track.

All set.


Report Abuse
enjoyablegamer321 is online. enjoyablegamer321
Joined: 05 Jul 2012
Total Posts: 9812
14 Jul 2017 10:01 PM
oh wait i get what you mean, thanks
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