Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why will my gui not rotate as commanded?

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?



while wait(1) do
	script.Parent.Rotation = script.Parent.Rotation - 1
	repeat wait(1) until script.Parent.Rotation == -11
	 if script.Parent.Rotation == -11 then
		script.Parent.Rotation = script.Parent.Rotation + 1
		repeat wait(1) until script.Parent.Rotation == 11
		break
	end
end


1 comment

0

you should put the repeat outside

2 answers

✓ Accepted answer

This might be what you're looking for:

while wait() do
	if script.Parent.Rotation >= 0 then
		repeat
			wait()
	script.Parent.Rotation = script.Parent.Rotation - 1
	until script.Parent.Rotation == -11
	end
	if script.Parent.Rotation < 0 then
		repeat 
			wait()
		script.Parent.Rotation = script.Parent.Rotation +1
		until script.Parent.Rotation == 11
	end
end

Try this:

local plus = false

while wait(1) do
	
	if plus == false then
		script.Parent.Rotation = script.Parent.Rotation - 1
	elseif plus == true then
		script.Parent.Rotation = script.Parent.Rotation + 1
	end
	
	if script.Parent.Rotation == -11 then
		plus = true
	elseif script.Parent.Rotation == 11 then
		plus = false
	end
	
end

Hope this helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.