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

Interpolation not working?

I have this script STRAIGHT from the wiki, it's not working.

			Interpolate(
				game.Players.LocalPlayer.Character.Torso.Position,
				game.Players.LocalPlayer.Character.Torso.Position,
				1
				)

1 comment

0

Why does everyone downvote me when my answer works?!?!?!?!

2 answers

✓ Accepted answer

It's not possible that you got that straight from the wiki since the wiki page looks like this


Your Problem

  • 1) You didn't define Interpolate.

    The Interpolate function is a function of Camera. You need to use it as a method from camera.

  • 2) Your 1st, and 2nd arguments are the wrong datatype!

    The 1st and 2nd arguments of the Interpolate function should be CFrames. You provided Vectors. To provide a CFrame, index the CFrame property of the character's torso, rather than the Position property.


Code

local cam = workspace.CurrentCamera --Define the camera
local plr = game.Players.LocalPlayer --Define the player

cam:Interpolate(
	plr.Character.Torso.CFrame, --Index 'CFrame' property
	plr.Character.Torso.CFrame,
	1
)

NOTE: Make sure this is a localscript in somewhere that replicates to the client. e.g. ReplicatedFirst, StarterPack, StarterGui.

2 comments

1

Camera needs to be Scriptable.

0

Thanks for pointing that out

Interpolate is a Method from a camera. This must be with a local script and, the camera type needs to be scriptable(also needs to be done in a local script).


#Camera Camera is an object in workspace and it affects the camera in the game for a player on the client. You need to set the camera type to scriptable.

--LocalScript
local camera = workspace.CurrentCamera --Or Camera
camera.CameraType = Enum.CameraType.Scriptable

#Interpolate It is a method, use it on the camera object

camera:Interpolate()


#Final Product

local camera = workspace.CurrentCamera --Or Camera
camera.CameraType = Enum.CameraType.Scriptable

camera:Interpolate(
    game.Players.LocalPlayer.Character.Torso.CFrame,
    game.Players.LocalPlayer.Character.Torso.CFrame,
    1
    )



Hope it helps!

1 comment

0

Arguments of the Interpolate function have to be a CoordinateFrame

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