So this might be very time consuming for someone to help me with but I have done most of the annoying work for you already.
The Gui is complete, buttons work and everything just test it and see for yourself. It doesn't look nice but that's not what I need help with so yeah.
Roblox Model: https://www.roblox.com/Spinner-Gui-item?id=463386983
Anyways, I need a way for it to test for the color that the spinner lands on... Now I know you can't test for colors (at least I dont think you can..?) however you can test for the rotation. So basically I need a script that tests for where the rotation of the spinner is.
For instance:
From 10-20 (in rotation) = red. So maybe something like
if script.Parent.Parent.Spinner.Rotation = 10 or 11 or 12 or 13 or 14 -- ... and so on. Easier way to do 10 - 20? then print("Red") end
I have no idea how to go about this, please look at the model and try to work with the code.
Side note: I made a script that spins it, obviously. In the script a function does math.random and rotates by a random amount every 0.001 seconds. This is only 1 spin though, I had to spam the function once the button was clicked. Is there an easier way to repeat a function rather than copy and paste? Thank you :)
The best way to test if a number is within a certain range is by doing this:
if script.Parent.Parent.Spinner.Rotation >= 10 and script.Parent.Parent.Spinner.Rotation <= 20 then print("Red") end
This will check if the rotation is greater than or equal to 10 and if it is less than or equal to 20. In other words, it checks to see if the rotation is between 10 and 20, inclusive.
As for the Spin function, you can use a for
loop, like this:
for i = 1, 300 do Spin() end
This will call Spin
300 times.
Additionally, if you want to make sure the wheel is perfectly circular, you can set its SizeConstraint
property to RelativeXX
or RelativeYY
(I found that XX was better). I would reccomend making the containing frame bigger as you can see the corners of the image on larger displays.