Roblox Studio:if then else 错误,尝试了一切

我不知道出了什么问题,它一直重复着同样的错误: 问题

local clicker = script.Parent.ClickDetector
local canclick = true

local chance = math.random(1,3)
if chance == 1 then
clicker.MouseClick:connect(function(Player)
    if canclick then
        if Player:FindFirstChild("Stand").Value == "The World" then
            Player:FindFirstChild("Stand").Value = "Nightmare World"
            canclick = true
            Player:LoadCharacter()
            script.Parent:Remove()
        else
    clicker.MouseClick:connect(function(Player)
    if canclick then
            Player:FindFirstChild("Stand").Value = "None"
            canclick = true
            Player:LoadCharacter()
            script.Parent:Remove()
        end
    end
end)

我已经尝试过添加结束语并替换结束语甚至添加括号,但没有什么作用。 如果您能够重写代码,或者帮助我解决这个问题,我将非常感激。

点赞
用户11815974
用户11815974
local clicker = script.Parent.ClickDetector
local canclick = true

local chance = math.random(1,3)
if chance == 1 then
    clicker.MouseClick:connect(function(Player)
        if canclick then
            if Player:FindFirstChild("Stand").Value == "The World" then
                Player:FindFirstChild("Stand").Value = "Nightmare World"
                canclick = true
                Player:LoadCharacter()
                script.Parent:Remove()
            else
                clicker.MouseClick:connect(function(Player)
                    if canclick then
                        Player:FindFirstChild("Stand").Value = "None"
                        canclick = true
                        Player:LoadCharacter()
                        script.Parent:Remove()
                    end
                end) -- 此处为缺失的结束语句
            end
        end
    end)
end
2019-10-04 04:49:15