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

How accurately can I make this repeat until the statement is true?

Asked by
Songist 49
6 years ago

So I am trying to experiment with cameras for a little intro, and everything is going fairly well except for at the end, at which point I want the camera to be focused back on the character. It sometimes works, but sometimes, especially if I open multiple tests at once, the camera will not revert back to the character.

Here's what I have. First, this sends the camera back to the character:

        workspace.CurrentCamera.CameraType = "Custom"
        workspace.CurrentCamera.CoordinateFrame = character.Torso.CFrame

Then, I tried to fix the times when it had an error by doing this:

if 
    workspace.CurrentCamera.CoordinateFrame ~= character.Torso.CFrame
    then repeat
        workspace.CurrentCamera.CameraType = "Custom"
        workspace.CurrentCamera.CoordinateFrame = character.Torso.CFrame
    until
    workspace.CurrentCamera.CoordinateFrame == character.Torso.CFrame
end

Sorry if it looks horrendous, I'm not experienced at all, so thanks for helping out!

0
I believe all you need to have is a camera subject for custom to work (character humanoids are used by default) NodaDuck45 15 — 6y
0
Oh ok cool, that works too. However, how do I loop it in a way that it continues to try to fix the camera to custom until it is true? Songist 49 — 6y

Answer this question