Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i fix the expected ')' error?

Asked by 4 years ago
local Arrow = script.Parent
local Click = Arrow:WaitForChild("Click")

Click.MouseClick:Connect(function(player)

    local Backpack = player:FindFirstChild("Backpack")
    if Backpack then
        local Stands = game:GetService("ServerStorage"):WaitForChild("Stands")

        local randomStand = math.random(1,3)
        if randomStand == 1 then
            --Give Stand1
            if Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") then
                local prevStand = workspace:FindFirstChild(player.Name.." Stand")
                local prev = Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Pickle") or Backpack:FindFirstChild("RR")
                prevStand:Destroy()
                prev:Destroy()

                local Stand = Stands:FindFirstChild("Mist"):Clone()
                Stand.Parent = Backpack
            else
                local Stand = Stands:FindFirstChild("Mist"):Clone()
                Stand.Parent = Backpack
            end

        elseif randomStand == 2 then
            --Give Stand2
            if Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") then
                local prevStand = workspace:FindFirstChild(player.Name.." Stand")
                local prev = Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR")
                prevStand:Destroy()
                prev:Destroy()

                local Stand = Stands:FindFirstChild("RR"):Clone()
                Stand.Parent = Backpack
            else
                local Stand = Stands:FindFirstChild("RR"):Clone()
                Stand.Parent = Backpack
            end

        elseif randomStand == 3 then
            --Give Stand3
            if Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") or Backpack:FindFirstChild("Pickle") then
                local prevStand = workspace:FindFirstChild(player.Name.." Stand")
                local prev = Backpack:FindFirstChild("Mist") or Backpack:FindFirstChild("RR") or Backpack:FindFirstChild("Pickle")
                prevStand:Destroy()
                prev:Destroy()

                local Stand = Stands:FindFirstChild("Pickle"):Clone()
                Stand.Parent = Backpack
            else
                local Stand = Stands:FindFirstChild("Pickle"):Clone()
                Stand.Parent = Backpack
            end
        end
    end
end

Error:Workspace.GiveStand:58: Expected ')' (to close '(' at line 5), got <eof> Line 5

1 answer

Log in to vote
0
Answered by 4 years ago

Maybe add a ) after the last end? like:

            end
        end
    end
end) -- here

The reason for this is that: the function is enclosed in parentheses of the :Connect() signal. That's why we need to add an extra ) at the end.

0
oh ok Not_prototype 50 — 4y
Ad

Answer this question