Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my camera go straight to the second camera part without lerping? [SOLVED]

Asked by 4 years ago
Edited 4 years ago

I want to make a script, so the CurrentCamera's CFrame lerps from one camera part to another camera part. This is what I wrote, it fires when a remote event fires all clients.

game.ReplicatedStorage.SeatCameraChange.OnClientEvent:Connect(function()
    workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
    for Num = 0, 1, 0.01 do
        workspace.CurrentCamera.CFrame = workspace.CameraPart.CFrame:Lerp(workspace.CloseChairCamera.CFrame, Num)
    end
end)

It doesn't move the camera. The camera goes straight to CloseChairCamera.CFrame with no lerp.

Any help would be appreciated.

1 answer

Log in to vote
0
Answered by 4 years ago

I fixed it. All I had to do was write this line of code after it.

game:GetService("RunService").RenderStepped:Wait()

This waited for the event to happen.

Ad

Answer this question