首页 > 解决方案 > 错误:(20,63)Expected ')'(在第 55 列关闭 '('),得到 =

问题描述

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(Test1,Test2)
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CFrame = Test1.CFrame

    local tween = TweenService:Create{camera, tweenInfo, (CFrame = Test2.CFrame)} 
    tween:play()

    wait(cutsceneTime)

    camera.CameraType = Enum.CameraType.Custom
end

wait(1)

tween(game.Workspace.Test1,game.Workspace.Test2)
local camera = game.Workspace.Camera

标签: luaroblox

解决方案


就像@Egor Skriptunoff所说,你应该替换(CFrame = Test2.CFrame){CFrame = Test2.CFrame},因为第三个参数TweenService:Create应该是Dictionary。您还应该替换{camera, tweenInfo, {CFrame = Test2.CFrame}}为,(camera, tweenInfo, {CFrame = Test2.CFrame})因为应该在元组中输入函数参数。

最终代码:

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(Test1,Test2)
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CFrame = Test1.CFrame

    local tween = TweenService:Create(camera, tweenInfo, {CFrame = Test2.CFrame}) 
    tween:play()

    wait(cutsceneTime)

    camera.CameraType = Enum.CameraType.Custom
end

wait(1)

tween(game.Workspace.Test1,game.Workspace.Test2)
local camera = game.Workspace.Camera

推荐阅读