01 | script.Parent.ClickDetector.MouseHoverEnter:Connect( function (player) -- my script |
02 | local part = script.Parent |
03 | repeat -- i want to make it so that if i hover on the part it will keep changing colors non stop |
04 | while true do -- I wanted this to loop forever until i hovered out of the Part |
05 | for i = 0 , 1 |
06 | do |
07 | wait( 0.5 ) -- controls interval between color change(so it changes color every half a second) |
08 | part.BrickColor = BrickColor.Random() -- what i want to happen while im hovering on the part |
09 | end |
10 | end |
11 | until part.ClickDetector.MouseHoverLeave:Connect( function (player) -- I do not know why,But when I stop hovering over it it just keeps going can someone explain why? |
12 | wait( 2 ) |
13 |
14 | part.BrickColor = BrickColor.new( "White" ) |
15 | end ) |
16 | end ) |
this is my script and my main problem is that when my cursor leaves the Part it doesn't stop and it just keeps going