lua - 错误:(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
解决方案
就像@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
推荐阅读
- javascript - 如何替换 Vue js 数组上的外部 javascript 数组?
- java - Hibernate 复杂的 1+N 问题将同一对象的多个实例提取到结果集中
- git - 使用 git 在本地和产品配置之间切换
- php - 按字段对数组中的数据进行分组 - 均匀排列
- ubuntu - Ubuntu 安装多个 Cuda 工具包版本及其补丁
- email - SSRS 在不打开 Outlook 的情况下点击发送邮件
- post - laravel 5.5.44 后路由器抛出 302 Found Error
- java - 使用多线程打印字母和数字
- c# - ASP.NET 表单 - 如何将表单数据发送到外部 WCF 服务
- angular - 如何订阅变量更改?