Part is not rotating

  1. What do you want to achieve? Keep it simple and clear!

I want to slowly rotate the part in Z and Y axes while going forward at 360 degree and backward.

  1. What is the issue? Include screenshots / videos if possible!

the issue is that the part is not rotating and I get this error

ServerScriptService.Rotation:6: invalid argument #2 (Vector3 expected, got boolean)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I did research on Google and developer forum but I was unable to find a solution for it.

local ts = game:GetService("TweenService")
local Z = game.Workspace:WaitForChild("Z")
local TimesOrientation = Z.Orientation == CFrame.new(0, 0, 135)

local twInfo = {TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, .1)}
local twProps = {Orientation = CFrame.new(0, 0, 0) * TimesOrientation}

print(twProps)

local X = ts:Create(Z, twInfo, twProps)

X:Play()

warn("Completed!")

The error is occuring because of the following line:

You’re checking if the orientation is equal to a specific value, which is a boolean.

1 Like

yeah thats what i see too i think u double the equal

so I did this instead, but got a new error ** Unable to cast Array to TweenInfo - Server - Rotation:9**

local ts = game:GetService("TweenService")
local Z = game.Workspace:WaitForChild("Z")

local twInfo = {TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, .1)}
local twProps = {Orientation = CFrame.new(0, 0, 0) * CFrame.new(0, 0, 135)}

print(twProps)

local X = ts:Create(Z, twInfo, twProps)

X:Play()

warn("Completed!")
local ts = game:GetService("TweenService")
local Z = game.Workspace:WaitForChild("Z")
local TimesOrientation = Z.Orientation = CFrame.new(0, 0, 135)

local twInfo = {TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, .1)}
local twProps = {Orientation = CFrame.new(0, 0, 0) * TimesOrientation}

print(twProps)

local X = ts:Create(Z, twInfo, twProps)

X:Play()

warn("Completed!")

try this

Remove the {} in this line.

local twInfo = {TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, .1)}

I removed it but theres this error

TweenService:Create property named ‘Orientation’ cannot be tweened due to type mismatch (property is a ‘Vector3’, but given type is ‘CoordinateFrame’)

did u try mine i edited it try to paste it into ur script

This is happening because you’re trying to put in a CFrame value in Orientation, which is a Vector3 value. You need to change one of the values.

I tried it but then I got this red line

I did what you said I changed both of the Value to Vector3 but I still get this red line

Change it to this:

local TimesOrientation = Vector3.new(0, 0, 135);

It worked! But how would I tween the position? I want it to go forward while rotating once it reached at 360 it stops and roll back.

I believe you would have to save the original orientation in a variable, then multiply that by Vector3.new(0, 0, 360). Then wait until the tween is finished, and tween it back to original orientation.

do I have to use DataStore for that?

No, just store it in a variable,

local OriginOrientation = Thing.Orientation

can I do this tho, will this work?

local ts = game:GetService("TweenService")
local Z = game.Workspace:WaitForChild("Z")
local ZPosition = Z.Position Vector3.new(-61.5, 11, -25);
local OriginOrientation = Z.Orientation Vector3.new(0, 0, -90);
local TimesOrientation = Z.Orientation Vector3.new(0, 0, 135);

local twInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, .1)
local twProps = {Orientation = Vector3.new(0, 0, 0) + ZPosition * TimesOrientation}

print(twProps)

local X = ts:Create(Z, twInfo, twProps)

X:Play()

warn("Completed!")
local tweenService = game:GetService("TweenService")
local Z = script.Parent

local info = TweenInfo.new(
	3, -- Length (seconds)
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0, -- times repeared
	false, -- reverse
	0 -- delay

)

local Goals = 
	{
		Orientation = Vector3.new(0,0,360);
	}

local moveUlapTween =  tweenService:Create(Z, info, Goals)
wait(3)
moveUlapTween:Play()

its spin

I don’t want it to spin I want the Part to rotate in Z and Y axes

did u try my script its a tweenservice