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

Interpolation not working?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

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
                )
0
Why does everyone downvote me when my answer works?!?!?!?! EzraNehemiah_TF2 3552 — 8y

2 answers

Log in to vote
3
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago

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.

1
Camera needs to be `Scriptable`. woodengop 1134 — 8y
0
Thanks for pointing that out Goulstem 8144 — 8y
Ad
Log in to vote
3
Answered by 8 years ago

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!

0
Arguments of the Interpolate function have to be a CoordinateFrame Goulstem 8144 — 8y

Answer this question