How do i make part rotate?

Title says everything what i need, i simple need part rotate

  1. What is the issue? Include screenshots / videos if possible!
    I have no clue how to make my script work. Idk if you need screenshots there because they are not need

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tryed to make my object orientation, but no idea how to make it spinning with it

local SpinObject = script.Parent

while true do
	SpinObject.Orientation = SpinObject.Orientation + 1
	wait(0.2)
end
6 Likes

Also i need to make same thing with object position like + 1 - 1 or etc.

2 Likes

Just use the rotate tool. If you mean after the player starts playing then idk.

2 Likes

Orientation is a Vector 3 value, meaning you can’t just do + 1. Vector 3s are composed of 3 values, i.e. x y and z. If you want your object to spin, lets say on the z axis, you’ll have to do something like this:

local SpinObject = script.Parent

while true do
	SpinObject.Orientation += Vector3.new(0,0,1)
	task.wait(0.2)
end
11 Likes

I mean with script not with rotate tool lol

2 Likes

Lemme see if it that’s i need 30 letters

1 Like

yeah it works but i’n wrong way i need it spin right not up

1 Like

yeah it works but i’n wrong way i need it spin right not up
image

1 Like

Ok, that’s what I thought but replied just in case.

1 Like

Hmmm it works thanks you all guys

1 Like
 += Vector3.new(0,0,1)

I’m new to scripting. I don’t understand why + is need after Orientation property?

1 Like

This is just another way to write a calculation formula.
SpinObject.Orientation += Vector3.new(0,0,1)
means
SpinObject.Orientation = SpinObject.Orientation + Vector3.new(0,0,1)

In many programming languages,
you can write i = i + 1 as i += 1, i = i - 1 as i -= 1, for example.

3 Likes

This is better

local SpinObject = script.Parent

while SpinObject and task.wait(0.2) do
	SpinObject.Orientation += Vector3.new(0,0,1)
end
2 Likes

+= is simply adding a new number instead of doing this:

-- Fast Way
workspace.NumberValue.Value += 1
print(workspace.NumberValue.Value) -- Printing Out The Value Inside The NumberValue And See If The Value Adds Up.

-- Slow Way
workspace.NumberValue.Value = workspace.NumberValue.Value + 1
print(workspace.NumberValue.Value) -- Printing Out The Value Inside The NumberValue And See If The Value Adds Up.
1 Like

You do not require scripts for this, instead look up how to use Motors and it will save you time and possibly resources.

Why are you guys still posting somewhere here. This is 2 years old come on. I already using motors in this point. Just like why are you writing this after so much time?

1 Like

Firstly, last reply was 9 days ago, if your issue was solved you should consider closing this topic rather than taking it out on people who are trying to help you.


Dude… This one is solved for 2 years already

2 Likes