Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Camera Interpolation Help?

I wish to use camera interpolation to create a looping sway of the camera. I understand that the following code allows this to happen:

local camera = workspace.CurrenctCamera
camera.CameraType = Enum.CameraType.Scriptable
camera:Interpolate (CFrame endPos, CFrame endFocus, float duration)

However, any time I attempt to use it (after inputting the C-Frames and wait duration) , nothing happens and the output shows nothing. Also, if possible could you point me towards how I can loop this function so it's a continuous sway of the camera?

1 answer

✓ Accepted answer

Unfortunately, you cannot use the Interpolate function to sway the camera if you are following an object like the player's character. For that, I would use the camera's Focus or CFrame. Now, to answer for why nothing happens with :Interpolate(), in edit mode, the :Interpolate() function seemed to act a bit strange, so you can't test it that way. If you are using :Interpolate() with a ServerScript then that's your problem. Each player is assigned to their own camera, which is only loaded on the client. So what you need to do is change that ServerScript to a LocalScript and the :Interpolate should work fine, as long as the LocalScript is in StarterGui, StarterPack, a Player, or a player's character.

2 comments

0

Do you have any ideas how I can create a looping sway effect?

0

I attempted to do something of the sort myself... didn't work all that well for me. I'll let you know if I get anything

This discussion is preserved as it was. New answers, comments, and votes are closed.