My part is not tweening

Hello developers! I need help with my part. It is not tweening.

The code

local ts = game:GetService("TweenService")
local part = script.Parent

local goal = {}
goal.Orientation = Vector3.new(0, -120, 0)

local twi = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false)
local tween = ts:Create(part, twi, goal)

game.ReplicatedStorage.RotateCam.OnServerEvent:Connect(function()
	tween:Play()
end)

Solutions I tried already

  • Doing CFrame

If you can help, please let me know. Thanks, WE

Where is this server script located ? Are any exceptions thrown in the output?

No errors, and the script is inside of the part that I want tweened.

Before position:

image

Video:

Why not just put the Tween information inside the function?

Doesn’t make a difference…

local ts = game:GetService("TweenService")
local part = script.Parent

game.ReplicatedStorage.RotateCam.OnServerEvent:Connect(function()
	local goal = {}
	goal.Orientation = Vector3.new(0, -120, 0)

	local twi = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false)
	local tween = ts:Create(part, twi, goal)
	tween:Play()
end)

It looks like it would work fine, try checking if the part is welded to something?

Then maybe the part is Unachored?

No the part is anchored.

@Tomatoe_s , the part had a Hinge for the camera, which gets destroyed in game so I know where the camera is. There are no welds at all… CanCollide is even turned off.

script.Parent.FrontSurface = Enum.SurfaceType.Smooth
script.Parent.Transparency = 1

Did you already check if the function actually did run?

1 Like

Added some prints, and yes it does run and go all the way to the end
image

local ts = game:GetService("TweenService")
local part = script.Parent

game.ReplicatedStorage.RotateCam.OnServerEvent:Connect(function()
	print("Ran")
	local goal = {}
	goal.Orientation = Vector3.new(0, -120, 0)

	local twi = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false)
	local tween = ts:Create(part, twi, goal)
	tween:Play()
	print("Finished")
end)

Also, I used this method of Tweening multiple times, for numerous different reasons, and it doesn’t seem to work this time for this…

Used the exact same script as you, works fine for me.
Are you sure its not the camera script?

I tested the script, it worked for me. Try increasing the time or replce goal with { Orientation = Vector3.new(0, 0, 180) }. And also check if the part actually Tweened, might be a camera problem as Tomatoe_s said.

Yea I completely forgot the camera existed…