您好我在Roblox用户和我试图脚本一个光开关,其关闭4个灯和我有一个误差(它是在标题)Roblox错误:预期“)”关闭“(”在第3列),得到了“=”
有正在使用的2个块,所述Off4和ON4开关。
我的代码是
function OnClicked()
if (workspace.LivingRoomLight.SpotLight.Enabled == true) and (workspace.LivingRoomLight2.SpotLight.Enabled == true) and (workspace.LivingRoomLight3.SpotLight.Enabled == true) and (workspace.LivingRoomLight4.SpotLight.Enabled == true) then
(workspace.LivingRoomLight.SpotLight.Enabled = false) and (workspace.LivingRoomLight2.SpotLight.Enabled == false) and (workspace.LivingRoomLight3.SpotLight.Enabled == false) and (workspace.LivingRoomLight3.SpotLight.Enabled == false)
script.Parent.Transparency = 1
workspace.Off4.Transparency = 0
end
end
script.Parent.ClickDetector.MouseClick:connect(OnClicked)
其他脚本(即工作),我只使用一个光的人用的是
function OnClicked()
if (workspace.Hallwaylight.SpotLight.Enabled == true) then
workspace.Hallwaylight.SpotLight.Enabled = false
script.Parent.Transparency = 1
workspace.Off.Transparency = 0
end
end
script.Parent.ClickDetector.MouseClick:connect(OnClicked)
注:我只用在脚本,因为这是我唯一编辑的错误之一。在脚本中的错误是第一=在第3栏,当我使用“==”,而不是“=”,那么整条生产线变成了错误
只要将条件放在括号(if())而不是操作中。 –