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

Script that can make a rotating brick spin for a certain time until it stops and then it repeats?

I don't really excel in scripting so I usually look on YouTube for solutions, but there weren't any helpful videos this time. Please help! :(

1 comment

0

Please, ScriptingHelpers isn't a request site, but I'll give you advice on how to make the script

1 answer

✓ Accepted answer

Let's say your brick is "Spinner"...

First of all, you need to get a reference to it inside the script by using a variable, like this :

Spinner = Workspace.Spinner
-- We asume "Spinner" is directly under Workspace

Then, we make some code to access the Rotation property of Spinner, and use a for loop to keep it running. We also use an if statement to reset the process once it's done.

for i = 1, 90 do
	wait(.1)
	Spinner.Rotation = i*2
	if i == 90 then
		i = 1
	end
end

All together, this simple script should rotate the brick by 2 degrees at 20 degrees per second. The complete code is below, using what "type of word" you should write

**Variable1** = *BrickReference*

for i = *IncrementValue*, *MaxValue* do
	wait(*Time*)
	**Variable1**.Rotation = *RotationIncrement*
	if i == *ResetValue* then
		i = *MinimumValue*
	end
end

2 comments

0

Thank you! This helped me a whole lot. :D

0

Please remember to approve an answer, that way the website displays this question as solved

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