Camera Jolt code Makes camera quickly rotate about 90 Degrees, Need help

Hello, I need help here.

I am trying to remake this.

I’ve tried and tested my code but it always results in the camera quickly rotating 90 degrees to the left.

robloxapp-20231111-1121454.wmv (341.3 KB)

This is the current Movement Code, I suspect that I am doing something VERY wrong as I am very Bad at CFrame / Positioning.

-- IN MODULE SCRIPT
return function(CameraInstance,Tweens,Conf)
	local TS = game:GetService("TweenService")
	--[[CameraInstance = game.Workspace.CurrentCamera
	Tweens = {
		[1] = TweenInfo.new(0.12,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
		[2] = TweenInfo.new(0.2,Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
	}]]


	local OldPosition = CameraInstance.CFrame

	--CameraInstance.CFrame = CFrame.Angles(0 + Conf["jolt_firstamount"],0,0)

	local t1 = TS:Create(CameraInstance,Tweens[1],{
	--	CFrame = CFrame.new(CameraInstance.CFrame.X + Conf["jolt_firstamount"],CameraInstance.CFrame.Y,CameraInstance.CFrame.Z)
		CFrame = CFrame.Angles(0,math.rad(0 + Conf["jolt_firstamount"]),0)
	})
	t1:Play()
	t1.Completed:Connect(function()
		t1:Destroy()

		local t2 = TS:Create(CameraInstance,Tweens[1],{
			CFrame = OldPosition
		})
		t2:Play()
		t2.Completed:Connect(function() t2:Destroy() end)
	end)

end

Can someone please help me?

i think what your doing wrong is during the first tween you set it to a fixed degree ammount instead of multipling the cameras cframe with the new anglews
the correct math probably would look like this

CFrame = CameraInstance.CFrame * CFrame.Angles(0,math.rad(0 + Conf["jolt_firstamount"]),0)

Thank you, That fixed all the issues!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.