Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why will my gui not rotate as commanded?

Asked by 5 years ago

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?

1while 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
9end
0
you should put the repeat outside TheRealPotatoChips 793 — 5y

2 answers

Log in to vote
0
Answered by
3132750 45
5 years ago

This might be what you're looking for:

01while 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
14end
Ad
Log in to vote
0
Answered by 5 years ago

Try this:

01local plus = false
02 
03while 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 
17end

Hope this helped!

Answer this question