Tween sequence "Argument 3 missing or nil"

I have a script that’s suppose to tween the player’s camera between 2 objects using a sequence, but I always get the error “Argument 3 missing or nil” when trying to use sequences.

local TweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
local TweenToPlayer = game.Players.LocalPlayer.Character:WaitForChild("UpperTorso").CFrame
local TweenToEnemy = game.Workspace.NormalFightingRingKlein.Enemies["Alvin Kleid"]:WaitForChild("UpperTorso").CFrame

local tweenInfo = TweenInfo.new(
	2, -- Time to get to objective
	Enum.EasingStyle.Quart,
	Enum.EasingDirection.InOut,
	0, -- RepeatCount
	false, -- Reverses
	0.5 -- DelayTime
)

local GameStartTweenSequence = TweenService:Create(Camera, tweenInfo)
GameStartTweenSequence:Create(Camera, {CFrame = TweenToPlayer})
GameStartTweenSequence:Create(Camera, {CFrame = TweenToEnemy})


local function onRoundStart1()
	GameStartTweenSequence:Play()
	GameStartTweenSequence.Completed:Wait()
	
	local new = game.ReplicatedStorage.RoundPopup1:Clone()
	new.Parent = script.Parent.PopupGuiGym
	print("Round 1 started!")
end

Hi, I’m a little bit confused on what your trying to do. You can’t create a tween then create a tween using that tween again.

To create a tween you should do this:

TweenService:Create(Camera, tweenInfo, {CFrame = TweenToPlayer})

If your trying to string together multiple tweens, just create multiple tween variables:

local Tween1 = TweenService:Create(Camera, tweenInfo, {CFrame = TweenToPlayer}
local Tween2 = TweenService:Create(Camera, tweenInfo, {CFrame = TweenToEnemy}

Tween1:Play()
Tween1.Completed:Wait()
Tween2:Play()

This is just a simplified version

The problem is that it needs to all be 1 long animation that tweens between the 2 objects, but it takes a small break in between tweens.

https://gyazo.com/6def96e989d711fdbfa5fbd61dac5c59

hmm, maybe instead of using.Completed:Wait(), just use a task.Wait() and set it to 1.9, then start the next tween before the first one finishes to link them more closely.

like this:

local Tween1 = TweenService:Create(Camera, tweenInfo, {CFrame = TweenToPlayer}
local Tween2 = TweenService:Create(Camera, tweenInfo, {CFrame = TweenToEnemy}

Tween1:Play()
task.wait(1.9)
Tween2:Play()

You could also adjust you tweenInfo (the tweenStyle) for a smoother transition between the tweens

Doing this just does the same thing but cuts off the animation early.

Ohhh sorry, Scratch what I just said and go back to what you had before. Its because you have a delay within you tweenInfo. Just remove it or set it to 0.

local tweenInfo = TweenInfo.new(
	2, -- Time to get to objective
	Enum.EasingStyle.Quart,
	Enum.EasingDirection.InOut,
	0, -- RepeatCount
	false, -- Reverses
	0.5 -- DelayTime   <---- Get rid of this or make it 0 <----
)

Does the same thing but doesn’t linger on the target object like I want it to.

So you want it to stop on the player then continue to the other player? Isn’t that what you had?

Removing the delay would get rid of the small break in between the tweens

Found the solution:

local tweenInfo = TweenInfo.new(
	2, -- Time to get to objective
	Enum.EasingStyle.Quart,
	Enum.EasingDirection.InOut,
	0, -- RepeatCount
	false, -- Reverses
	0.5 -- DelayTime
)

local Tween1 = TweenService:Create(Camera, tweenInfo, {CFrame = TweenToPlayer})
local Tween2 = TweenService:Create(Camera, tweenInfo, {CFrame = TweenToEnemy})


local function onRoundStart1()
	Tween1:Play()
	Camera.CameraType = Enum.CameraType.Scriptable
	Tween1.Completed:Wait()
	Tween2:Play()
	Tween2.Completed:Wait()
	Camera.CameraType = Enum.CameraType.Custom
	
	local new = game.ReplicatedStorage.RoundPopup1:Clone()
	new.Parent = script.Parent.PopupGuiGym
	print("Round 1 started!")
end

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