您好我在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())而不是操作中。 –