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

I tried to tween the camera onto the player, but it does not work, what do I do?

Asked by
To0_ny 141
4 years ago

I wanted to tween the camera so it focus on the player, however, it does not happen what do I do script:

local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local button = script.Parent
local TS = game:GetService("TweenService")


local info = TweenInfo.new(
    3,
    Enum.EasingStyle.Sine,
    Enum.EasingDirection.In,
    0,
    false,
    0
)


button.MouseButton1Click:Connect(function()
    cam.CameraType = Enum.CameraType.Custom
    local Goals = {cam.CameraSubject = player:FindFirstChild("Humanoid")}
    local humanTween = TS:Create(cam, info, Goals)
    humanTween:Play()
end)
0
Just a heads up, you don't need all the parameters when creating TweenInfo. kingblaze_1000 359 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

You want to include only the name of the property, not the instance of which you want to tween in the goals. And I'm not sure if you can tween a property with an Instance value.

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You will need to turn the CurrentCamera type to "Scriptable" before tweening it's position

You can do this by writing this line:

cam.CameraType = Enum.CameraType.Scriptable

Or you can write:

cam.CameraType = "Scriptable"

You would write one of these lines instead of "Custom"

Answer this question