When I was working on my game I started trying to add more stuff into it, so I added a little script that rotates a gui. However the gui will not rotate, what did I do wrong?
1 | while wait( 1 ) do |
2 | script.Parent.Rotation = script.Parent.Rotation - 1 |
3 | repeat wait( 1 ) until script.Parent.Rotation = = - 11 |
4 | if script.Parent.Rotation = = - 11 then |
5 | script.Parent.Rotation = script.Parent.Rotation + 1 |
6 | repeat wait( 1 ) until script.Parent.Rotation = = 11 |
7 | break |
8 | end |
9 | end |
This might be what you're looking for:
01 | while wait() do |
02 | if script.Parent.Rotation > = 0 then |
03 | repeat |
04 | wait() |
05 | script.Parent.Rotation = script.Parent.Rotation - 1 |
06 | until script.Parent.Rotation = = - 11 |
07 | end |
08 | if script.Parent.Rotation < 0 then |
09 | repeat |
10 | wait() |
11 | script.Parent.Rotation = script.Parent.Rotation + 1 |
12 | until script.Parent.Rotation = = 11 |
13 | end |
14 | end |
Try this:
01 | local plus = false |
02 |
03 | while wait( 1 ) do |
04 |
05 | if plus = = false then |
06 | script.Parent.Rotation = script.Parent.Rotation - 1 |
07 | elseif plus = = true then |
08 | script.Parent.Rotation = script.Parent.Rotation + 1 |
09 | end |
10 |
11 | if script.Parent.Rotation = = - 11 then |
12 | plus = true |
13 | elseif script.Parent.Rotation = = 11 then |
14 | plus = false |
15 | end |
16 |
17 | end |
Hope this helped!