How to sync cutscene with effect

Hey, I’m using CodeOtaku’s cutscene plugin and I’m wondering how I would sync a color correction effect with it. I want the effect to happen when the 3rd capture starts to play. Here’s a portion of the module code:

function Cutscene:GetDuration(Speed)
	Speed = Speed or 1
	local count = 0
	for i,X in pairs(self.Data[1]) do
		count = count+X[4]+X[6]
	end
	return count/Speed
end

function Cutscene:Update(delta)
	if self.Playing == true and self.Paused == false and self.Camera then
		self.Camera.CameraType = Enum.CameraType.Scriptable
		if self.Counter >= self.NextInstruction then
			self.Instruction = self.Instruction + 1
			local X = self.Data[1][self.Instruction]
			if X then
				if X[4] == 0 then
					self.Camera.FieldOfView = X[2]
					self.Camera.CFrame = X[1]
				end
				local TI = TweenInfo.new(X[4]/self.Speed, X[3], X[5], 0, false, X[6]/self.Speed)
				local TI2 = TweenInfo.new(X[4]/self.Speed, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, X[6]/self.Speed)
				local Properties = {
					["CFrame"] = X[1]
				}
				self.CurrentTween = TS:Create(self.Camera, TI, Properties)
				self.CurrentFOVTween = TS:Create(self.Camera, TI2, {FieldOfView = X[2]})
				self.CurrentTween:Play()
				self.CurrentFOVTween:Play()
				self.Counter = 0
				self.NextInstruction = (X[4]+X[6])/self.Speed
				self.ENextKeyframe:Fire(self.Instruction, self.NextInstruction, X)
			else
				if self.Looped then
					self.Instruction = 0
					self.Counter = 0
					self.Elapsed = 0
					self.NextInstruction = 0
					self.DidLoop:Fire()
				else
					self:Stop()

				end
			end
		end
		self.Counter = self.Counter + delta
		self.Elapsed = self.Elapsed + delta
	end
end
1 Like

Well, I’d try to add a conditital statement to check if the current instruction is the 3rd one, like:

if self.Instruction == 3 then
      -- Aplly your effects
end

I’m not sure if that works, but try it

1 Like

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