Hello!
So in my game there is a pretty basic cutscene where the camera basically glides cinematically around a scene. But in my code, the last few lines are supposed to have the camera set to a new location but stay still there. But when that happens is the lerping from before plays again... sorry if this is badly phrased, I can't find a better way. This is my code:
--// Client
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
--// Main
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPartCutscene.CFrame
wait(4)
wait(2)
Camera.CFrame = workspace.CameraPartCutscene2.CFrame
local to = workspace.to.CFrame
local speed = 2
game:GetService('RunService').Heartbeat:connect(function(step) --http://wiki.roblox.com/index.php?title=API:Class/RunService/Heartbeat
Camera.CFrame = Camera.CFrame:lerp(to,step/speed) --basic lerp
end)
wait(2)
Camera.CFrame = workspace.CameraPartCutscene3.CFrame
local to2 = workspace.to2.CFrame
local speed2 = 2
game:GetService('RunService').Heartbeat:connect(function(step2) --http://wiki.roblox.com/index.php?title=API:Class/RunService/Heartbeat
Camera.CFrame = Camera.CFrame:lerp(to2,step2/speed2) --basic lerp
end)
wait(5)
Camera.CFrame = workspace.CameraPartCutscene4.CFrame--Supposed to set the camera to a place and stay static, although it glides from camerapartcutscene4 to to2. weird
wait(2)
Camera.CFrame = workspace.CameraPartCutscene5.CFrame --Supposed to set the camera to a place and stay static, although it glides from camerapartcutscene5 to to2. weird
If you need a better idea understanding to my problem, here is a link to the game. Pay attention to the last shot. https://web.roblox.com/games/4572698580/anim
Sorry if my code is badly written or I'm not using it properly... I am new to lerp.
Thanks, any help is appreciated!
