Scripting Help Roblox

Expected end to close at line 20.did you forget to close at line 37?

ah you have so many errors

local RepStore = game:GetService("ReplicatedStorage")

game.Players.PlayerAdded:Connect(function(Player)
	
	
	local Stats = Instance.new("Folder")
	Stats.Name = "leaderstats"
	Stats.Parent = Player
	
	local Coins = Instance.new("IntValue")
	Coins.Value = 0
	Coins.Name = "Coins"
	Coins.Parent = Stats
	
	local Swords = Instance.new("Folder")
	Swords.Name = "Swords"
	Swords.Parent = game.StarterPack
	
	
	Player.CharacterAdded:Connect(function(Character)
	
		local SwordFolder = RepStore.Swords
		
		local Highest = 0
		
		local Dictionary = {
			[100] = SwordFolder.Sword1,
			[200] = SwordFolder.Sword2,
			[300] = SwordFolder.Sword3,
		}
		local equippedval = Instance.new("BoolVal") -- this is the equipped val
		if equippedval.Value ~= true then
			local function Check()
				for req, sword in pairs(Dictionary) do
					
					if Coins.Value <= req then
						Player.Backpack:ClearAllChildren()
						equippedval.Value = true
						end
				end
				end
end
end)