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

There is a error on the last "end)" near the bottom of the script? (I am a beginner)

Asked by 2 years ago
Edited 2 years ago

There is a error on the last "end)" near the bottom of the script.

Here's the script:

script.Parent.TouchPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        game.GUIS.GamepassShop.ShopFrame.Visible = true 
         game.Workspace.MainBase.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then
                game.GUIS.GamepassShop.ShopFrame.Visible = false
                game.Workspace.SideWalk2.Touched:Connect(function(hit)
                    if hit.Parent:FindFirstChild("Humanoid") then
                        game.GUIS.GamepassShop.ShopFrame.Visible = false
                    end
                end)
            end
            end)
        end
    end
end)

and here's the error message:

                       Workspace.Buildings.Shop.Script:16: Expected ')' (to close '(' at line 1), got 'end' 

I am a beginner and I don't understand this error message.

0
Please format your script better so we can help more easily. There is a 'Code Block' option when asking a question that formats your code better so it is easier to read. appxritixn 2235 — 2y

2 answers

Log in to vote
4
Answered by
appxritixn 2235 Moderation Voter Community Moderator
2 years ago

The error message is stating that every time you place a '(' you will need a closing ')'. In your case, you had an extra 'end' keyword where it was not needed.

You had this:

script.Parent.TouchPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        game.GUIS.GamepassShop.ShopFrame.Visible = true
        game.Workspace.MainBase.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then
                game.GUIS.GamepassShop.ShopFrame.Visible = false
                game.Workspace.SideWalk2.Touched:Connect(function(hit)
                    if hit.Parent:FindFirstChild("Humanoid") then
                        game.GUIS.GamepassShop.ShopFrame.Visible = false
                    end 
                end) 
            end 
        end) 
    end 
end end)

when you needed this:

script.Parent.TouchPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        game.GUIS.GamepassShop.ShopFrame.Visible = true
        game.Workspace.MainBase.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then
                game.GUIS.GamepassShop.ShopFrame.Visible = false
                game.Workspace.SideWalk2.Touched:Connect(function(hit)
                    if hit.Parent:FindFirstChild("Humanoid") then
                        game.GUIS.GamepassShop.ShopFrame.Visible = false
                    end 
                end) 
            end 
        end) 
    end 
end)
Ad
Log in to vote
0
Answered by 2 years ago

i had this:

script.Parent.TouchPart.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        game.GUIS.GamepassShop.ShopFrame.Visible = true 
         game.Workspace.MainBase.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid") then
                game.GUIS.GamepassShop.ShopFrame.Visible = false
                game.Workspace.SideWalk2.Touched:Connect(function(hit)
                    if hit.Parent:FindFirstChild("Humanoid") then
                        game.GUIS.GamepassShop.ShopFrame.Visible = false
                    end
                end)
            end
            end)
        end
    end
end)

Answer this question