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

How to make a rotation more than 1 time?

Ok. I have a rotating part, but for some reason it can rotate only 1 time. Idk why.

			local number1 = part.Rotation.Z
			local number2 = number1 + 90
			print(number1)
				
				UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
					if Input.KeyCode == Enum.KeyCode.R then
					part.Rotation = Vector3.new(90, 0, number2)

1 answer

✓ Accepted answer

You need to update number2 as the rotation changes. Change it to this:

    UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
        if Input.KeyCode == Enum.KeyCode.R then
			local number1 = part.Rotation.Z
			local number2 = number1 + 90
			print(number1)
	        part.Rotation = Vector3.new(90, 0, number2)

This way number2 will update every time depending on the part's rotation on that iteration, rather than remaining consistent to the part's starting rotation.

2 comments

0

idk why, but when I insert your script, the part turns not 90, but in a random direction. to all this, the game is very laggy

0

ok. i fixed this. i just added debounce. anyway i accept your answer.

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