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

I got this script from alvin blox and it says error on line 13. attempt to call nil value?

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera

local cutsceneTime = 12

local tweenInfo = TweenInfo.New(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1,part2)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()
	wait(cutsceneTime)
	
	camera.CameraType = Enum.CameraType.Custom
end

wait(2)

tween(game.Workspace.Test1,game.Workspace.Test2)

1 answer

✓ Accepted answer

hi i fixed it

local TweenService = game:GetService("TweenService")

local camera = game.Workspace.Camera

local cutsceneTime = 12

local tweenInfo = TweenInfo.new(
    cutsceneTime,
    Enum.EasingStyle.Sine,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)

function tween(part1,part2)
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CFrame = part1.CFrame

    local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
    tween:Play()
    wait(cutsceneTime)

    camera.CameraType = Enum.CameraType.Custom
end

wait(2)

tween(game.Workspace.Test1,game.Workspace.Test2)

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