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
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
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 <----
)