Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

1 comment

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.

2 answers

✓ Accepted answer

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)

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.